Tweepy SSLError regarding ssl certificate

后端 未结 5 1235
不思量自难忘°
不思量自难忘° 2021-01-06 05:13

I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it\'s totally fine. But now I am working on this in different networks and I got

5条回答
  •  佛祖请我去吃肉
    2021-01-06 05:59

    I ran into the same problem and unfortunately the only thing that worked was setting verify=False in auth.py in Tweepy (for me Tweepy is located in /anaconda3/lib/python3.6/site-packages/tweepy on my Mac):

    resp = requests.post(self._get_oauth_url('token'),
                                 auth=(self.consumer_key,
                                       self.consumer_secret),
                                 data={'grant_type': 'client_credentials'},
                                 verify=False)
    

    Edit:

    Behind a corporate firewall, there is a certificate issue. In chrome go to settings-->advanced-->certificates and download your corporate CA certificate. Then, in Tweepy binder.py, right under session = requests.session() add

    session.verify = 'path_to_corporate_certificate.cer'

提交回复
热议问题