Fixed SSL issue in OSX

Added Certifi following https://github.com/aio-libs/aiohttp/issues/955
This commit is contained in:
laramies 2020-05-02 00:57:36 +02:00
parent cec47acedd
commit befcbd1813
2 changed files with 8 additions and 3 deletions

View file

@ -11,4 +11,6 @@ retrying==1.3.3
shodan==1.22.0
texttable==1.6.2
lxml==4.5.0
uvloop==0.14.0
uvloop==0.14.0
certifi==4.5.1
ssl==1.16

View file

@ -5,7 +5,8 @@
import asyncio
import aiohttp
import random
import ssl
import certifi
class Core:
@staticmethod
@ -430,6 +431,7 @@ async def fetch(session, url, params='', json=False, proxy="") -> Union[str, dic
# Wrap in try except due to 0x89 png/jpg files
# This fetch method solely focuses on get requests
# TODO determine if method for post requests is necessary
if proxy != "":
if params != "":
async with session.get(url, params=params, proxy=proxy) as response:
@ -445,7 +447,8 @@ async def fetch(session, url, params='', json=False, proxy="") -> Union[str, dic
return await response.text() if json is False else await response.json()
else:
async with session.get(url) as response:
sslcontext = ssl.create_default_context(cafile=certifi.where())
async with session.get(url, ssl=sslcontext) as response:
await asyncio.sleep(2)
return await response.text() if json is False else await response.json()
except Exception as e: