Proxy and Import

Proxy and Import

Postby Carosmagor » Thu Aug 07, 2014 12:23 pm

Hello everybody,

I would like to know if i could use a "pro-trick" to avoid defining the proxy in every imported module.
For example, i'm developping a small app using the FB API and when i send a request (in the prorgam) to get an object, i can't make it, because somewhere in the facebook module i have to define the proxy.
Same, while trying to access a web database, i fall into the proxy problem again...

Is there a way to set it up once for all, like for every outgoing connection of any python application -> go through proxy.

I know how to set it up manually for a urlopen standard request... but it's quite annoying to search into imported modules...

Just a short example for the facebook api (errno 10060 : too many blablabla... no answer... not working... go to hell)

Code: Select all
import facebook

token = 'blabla'

graph = facebook.GraphAPI(token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")

friend_list = [friend['name'] for friend in friends['data']]


Thanks for your help !
Posts: 1
Joined: Thu Aug 07, 2014 12:12 pm

Return to Networking

Who is online

Users browsing this forum: No registered users and 3 guests