Using Tweepy API behind proxy

Posted by user1505819 on Stack Overflow See other posts from Stack Overflow or by user1505819
Published on 2012-11-01T10:40:18Z Indexed on 2012/11/01 11:00 UTC
Read the original article Hit count: 568

Filed under:
|
|
|

I have a using Tweepy, a python wrapper for Twitter.I am writing a small GUI application in Python which updates my twitter account.

Currently, I am just testing if the I can get connected to Twitter, hence used test() call. I am behind Squid Proxy server.What changes should I make to snippet so that I should get my work done.

Setting http_proxy in bash shell did not help me.

def printTweet(self):
    #extract tweet string
    tweet_str = str(self.ui.tweet_txt.toPlainText()) ;
    #tweet string extracted.
    self.ui.tweet_txt.clear()  ;

    self.tweet_on_twitter(str);

def tweet_on_twitter(self,my_tweet) :
    auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET);
    auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) ;
    api = tweepy.API(auth) ;

    if api.test() :
        print 'Test successful' ;
    else :
        print 'Test unsuccessful';

© Stack Overflow or respective owner

Related posts about python

Related posts about oauth