skip to Main Content

I want to use proxy (with/without auth) with Twitter API via Tweepy in Python
Reading the documentation I tried something (I think really wrong) like this:

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth, proxy='1.2.3.4:1234')

But obviously didn’t work

2

Answers


  1. Since Tweepy doesn’t seems to support proxy, you can change the ones on your system changing the https_proxy variable

    On Linux:

    export HTTPS_PROXY="http://xxxx:8888"
    

    On Windows:

    set https_proxy=https://username:password@host:port
    

    You can do it before launching the script or inside it, using subprocess to run a command

    Login or Signup to reply.
  2. I had the same issue due to twitter ban in my country, all i did was to download a VPN application(Hide me VPN) and the code worked.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search