0

I am simply trying to get the username and I end up with above error. My internet connection uses proxy and I have already modified my code to use urllib2 but nothing seems to be working here in below code.

import tweepy 
import dbapi 
import urllib, urllib2, httplib

proxy_support = urllib2.ProxyHandler({"http":'proxyurl'})

opener = urllib2.build_opener(proxy_support,urllib2.HTTPHandler)
urllib2.install_opener(opener) 

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)  
auth.set_access_token(access_token, access_token_secret)  

api = tweepy.API(auth)  
print(api.me().screen_name)

Any help will be really appreciated

sashkello
  • 17,306
  • 24
  • 81
  • 109
DollyM
  • 11
  • 2
  • have you tried to look through tweepy sources to find the location and exact reason of a mistake? – oleg.foreigner Sep 13 '13 at 06:08
  • oh... I found nothing. Do you have such a mistake without proxy_support? Just tweepy? – oleg.foreigner Sep 13 '13 at 06:16
  • I tried with options with or without this proxy_support but nothing seems to be working. – DollyM Sep 13 '13 at 07:24
  • and how about urlopen() any website? the same mistake? – oleg.foreigner Sep 13 '13 at 07:26
  • import urllib, urllib2, httplib proxy_support = urllib2.ProxyHandler({"http":'http://proxy:8083/'}) opener = urllib2.build_opener(proxy_support,urllib2.HTTPHandler) urllib2.install_opener(opener) urllib2.urlopen('http://www.google.co.in') ***** this doesnt throw any error but it couldnt open google website also. – DollyM Sep 13 '13 at 07:56
  • hm... what about your 'proxy:8083/'? could it be a DNS error? – oleg.foreigner Sep 13 '13 at 08:03
  • I just found one forum where it says that If your internet connection fails, then we would get below error: "TweepError: Failed to send request: [Errno 11004] getaddrinfo failed" however in my case net connection is working fine. Not sure now what could be the cause? – DollyM Sep 13 '13 at 08:08
  • [Wiki-getaddrinfo](https://en.wikipedia.org/wiki/Getaddrinfo) I think it is really dns problem. your lookup for 'proxy' is failing. Have you tried ip:port instead of domain-name:port? – oleg.foreigner Sep 13 '13 at 08:10
  • unfortunately, replacing proxy server with IP adress also didnt fix:( – DollyM Sep 13 '13 at 08:26
  • that's very strange... have you tried sudo? :) – oleg.foreigner Sep 13 '13 at 08:44
  • Sudo is for linux right? – DollyM Sep 13 '13 at 08:56
  • tried this http://stackoverflow.com/questions/16709583/urlerror-urlopen-error-errno-11004-getaddrinfo-failed also – DollyM Sep 13 '13 at 09:01
  • dns lookup fail... as I said... but it still doesn't work – oleg.foreigner Sep 13 '13 at 09:03
  • totally agree with you.. May be I will try once when i am out of office network without proxy. – DollyM Sep 13 '13 at 09:28

0 Answers0