Skip to content

Commit

Permalink
Merge pull request #13 from seatable/use-simple-cookie
Browse files Browse the repository at this point in the history
use SimpleCookie
  • Loading branch information
freeplant authored Aug 6, 2021
2 parents 2e53812 + 72a41bb commit aff7b45
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions seatable_thumbnail/http_request.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib.parse
from http.cookies import SimpleCookie

import seatable_thumbnail.settings as settings

Expand Down Expand Up @@ -30,10 +31,8 @@ def parse_cookies(self):
cookies = {}
if self.headers.get('cookie'):
cookie_string = self.headers.get('cookie')[0]
for item in cookie_string.split('; '):
k = item.split('=')[0]
v = item.split('=')[1].rstrip(';')
cookies[k] = v
s = SimpleCookie(cookie_string)
cookies = {v.key: v.value for k, v in s.items()}
self.cookies = cookies

def parse_url(self):
Expand Down

0 comments on commit aff7b45

Please sign in to comment.