Merge pull request #25 from NotoriousRebel/dev

Added docstring.
This commit is contained in:
Matt 2019-12-30 23:08:26 -05:00 committed by GitHub
commit caec73691d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ def __init__(self, word):
async def request(self, url, first=False):
try:
if first:
# indicates first request to extract cookie
async with aiohttp.ClientSession(headers=self.headers, timeout=self.timeout) as sess:
async with sess.get(url) as resp:
await asyncio.sleep(3)
@ -57,6 +58,7 @@ async def create_cookies(self, cookie):
async def get_cookies(self, headers):
try:
if headers is None:
# In this case just return default dict
return {}
elif 'set-cookie' in headers:
cookies = await self.create_cookies(headers['set-cookie'])