twintproject / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
15.64k stars 2.72k forks source link

Error certificate verify fail: how to solve? [QUESTION] #1393

Open mariejosep opened 2 years ago

mariejosep commented 2 years ago

Command Ran

I imported twint and nest_asyncio and then I receive the error after the following command: c = twint.Config() c.Search = "NFT" twint.run.Search(c)

Description of Issue

I receive the following error: WARNING:root:Error retrieving [https://twitter.com/](): SSLError(MaxRetryError("HTTPSConnectionPool(host='twitter.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))")), retrying

Environment Details

Used Anaconda to install Twint and then imported it in Jupyter Notebook.

Piranha900 commented 2 years ago

Try to replace trust_env = True in line 160 of get.py. I had a similar error with a self signed certificate.

From this:

async def Request(_url, connector=None, params=None, headers=None):                    
    logme.debug(__name__ + ':Request:Connector')
    async with aiohttp.ClientSession(connector=connector, headers=headers) as session: 
        return await Response(session, _url, params)

To this:

async def Request(_url, connector=None, params=None, headers=None):                    
    logme.debug(__name__ + ':Request:Connector')
    async with aiohttp.ClientSession(connector=connector, headers=headers, trust_env = True) as session: 
        return await Response(session, _url, params)