|
2010-04-20
, 14:52
|
Posts: 547 |
Thanked: 1,383 times |
Joined on Sep 2009
@ Stockholm, Sweden
|
#2
|
|
2010-04-20
, 14:54
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#3
|
|
2010-04-20
, 16:41
|
Posts: 79 |
Thanked: 20 times |
Joined on Apr 2010
|
#4
|
|
2010-04-20
, 19:24
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#5
|
def getProxy(): import gconf if gconf.client_get_default().get_bool('/system/http_proxy/use_http_proxy'): port = gconf.client_get_default().get_int('/system/http_proxy/port') http = gconf.client_get_default().get_string('/system/http_proxy/host') proxy = proxy = urllib2.ProxyHandler( {"http":"http://%s:%s/"% (http,port)} ) return (True, proxy) return (False, None) # Enable proxy support (proxy_support, proxy) = getProxy() if proxy_support: opener = urllib2.build_opener(proxy) urllib2.install_opener(opener) ### Use urllib2.urlopen("http://...") f = urllib2.urlopen("http://www.google.com") data = f.read() f.close()
The Following User Says Thank You to Slocan For This Useful Post: | ||
|
2010-04-22
, 20:50
|
Posts: 1,548 |
Thanked: 7,510 times |
Joined on Apr 2010
@ Czech Republic
|
#6
|
|
2010-04-23
, 16:55
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#7
|
|
2010-04-27
, 13:04
|
Posts: 1,548 |
Thanked: 7,510 times |
Joined on Apr 2010
@ Czech Republic
|
#8
|
|
2010-04-27
, 13:43
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#9
|
In a surprising turn of events, the users, who previously reported errors, say its now working without problems...
Because I have done no modification to the downloading code, their internet connectivity was either misconfigured or there were some other external factors.
Conclusion: It is really not needed to ask for Internet connectivity on the N900, if there is already an active Internet connection.
So anyway, thanks for feedback, everybody !
My application uses Internet for downloading files (OSM tiles, using the urllib.urlretrieve function) and everything works when running in Scratchbox. But on the N900, users report download errors, even though other applications (web browser, etc.) can use the Internet just fine.
So I would like to ask:
* Do I need to "enable" Internet connectivity for the application ?
* How can i do that, for a Python program ?
Thanks in advance !
Martin