urllib timeout

K

kBob

I created a script to access weather satellite imagery fron NOAA's
ADDS.

It worked fine until recently with Python 2.6.

The company changed the Internet LAN connections to "Accept Automatic
settings" and "Use automatic configuration script"

How do you get urllib.urlopen to use the the "automatic script"
configuration?

This code worked recently, until the company implemented these LAN
connections...

SAT_URL = "http://adds.aviationweather.gov/data/satellite/
latest_BWI_vis.jpg"
satpic = urllib.urlopen(SAT_URL, proxies=0 )
satimg = satpic.read()


Kelly Dean
Fort Collins, CO
 
M

MRAB

kBob said:
I created a script to access weather satellite imagery fron NOAA's
ADDS.

It worked fine until recently with Python 2.6.

The company changed the Internet LAN connections to "Accept Automatic
settings" and "Use automatic configuration script"

How do you get urllib.urlopen to use the the "automatic script"
configuration?

This code worked recently, until the company implemented these LAN
connections...

SAT_URL = "http://adds.aviationweather.gov/data/satellite/
latest_BWI_vis.jpg"
satpic = urllib.urlopen(SAT_URL, proxies=0 )
satimg = satpic.read()
For the record, I got:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\urllib.py", line 79, in urlopen
opener = FancyURLopener(proxies=proxies)
File "C:\Python26\lib\urllib.py", line 617, in __init__
URLopener.__init__(self, *args, **kwargs)
File "C:\Python26\lib\urllib.py", line 129, in __init__
assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
AssertionError: proxies must be a mapping

However, urllib.urlretrieve(...) works.
 
K

kBob

For the record, I got:

 >>> import urllib
 >>> SAT_URL =
"http://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg"
 >>> satpic = urllib.urlopen(SAT_URL, proxies=0 )
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\Python26\lib\urllib.py", line 79, in urlopen
     opener = FancyURLopener(proxies=proxies)
   File "C:\Python26\lib\urllib.py", line 617, in __init__
     URLopener.__init__(self, *args, **kwargs)
   File "C:\Python26\lib\urllib.py", line 129, in __init__
     assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
AssertionError: proxies must be a mapping

However, urllib.urlretrieve(...) works.- Hide quoted text -

- Show quoted text -

I saw that, but I still get the same error time out error ...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python26\lib\urllib.py", line 93, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "c:\python26\lib\urllib.py", line 237, in retrieve
fp = self.open(url, data)
File "c:\python26\lib\urllib.py", line 205, in open
return getattr(self, name)(url)
File "c:\python26\lib\urllib.py", line 344, in open_http
h.endheaders()
File "c:\python26\lib\httplib.py", line 904, in endheaders
self._send_output()
File "c:\python26\lib\httplib.py", line 776, in _send_output
self.send(msg)
File "c:\python26\lib\httplib.py", line 735, in send
self.connect()
File "c:\python26\lib\httplib.py", line 716, in connect
self.timeout)
File "c:\python26\lib\socket.py", line 514, in create_connection
raise error, msg
IOError: [Errno socket error] [Errno 10060] A connection attempt
failed because
the connected party did not properly respond after a period of time,
or establis
hed connection failed because connected host has failed to respond

Kelly
 
M

MRAB

kBob said:
For the record, I got:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\urllib.py", line 79, in urlopen
opener = FancyURLopener(proxies=proxies)
File "C:\Python26\lib\urllib.py", line 617, in __init__
URLopener.__init__(self, *args, **kwargs)
File "C:\Python26\lib\urllib.py", line 129, in __init__
assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
AssertionError: proxies must be a mapping

However, urllib.urlretrieve(...) works.- Hide quoted text -

- Show quoted text -

I saw that, but I still get the same error time out error ...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python26\lib\urllib.py", line 93, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "c:\python26\lib\urllib.py", line 237, in retrieve
fp = self.open(url, data)
File "c:\python26\lib\urllib.py", line 205, in open
return getattr(self, name)(url)
File "c:\python26\lib\urllib.py", line 344, in open_http
h.endheaders()
File "c:\python26\lib\httplib.py", line 904, in endheaders
self._send_output()
File "c:\python26\lib\httplib.py", line 776, in _send_output
self.send(msg)
File "c:\python26\lib\httplib.py", line 735, in send
self.connect()
File "c:\python26\lib\httplib.py", line 716, in connect
self.timeout)
File "c:\python26\lib\socket.py", line 514, in create_connection
raise error, msg
IOError: [Errno socket error] [Errno 10060] A connection attempt
failed because
the connected party did not properly respond after a period of time,
or establis
hed connection failed because connected host has failed to respond
It should be like this:

SAT_URL =
"http://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg"
SAT_FILE = r"C:\latest_BWI_vis.jpg"
urllib.urlretrieve(SAT_URL, SAT_FILE)
 
K

kBob

I saw that, but I still get the same error time out error ...
import urllib
SAT_URL = "http://adds.aviationweather.gov/data/satellite/"
SAT_FILE = "latest_BWI_vis.jpg"
satimg = urllib.urlretrieve( SAT_URL, SAT_FILE )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "c:\python26\lib\urllib.py", line 237, in retrieve
    fp = self.open(url, data)
  File "c:\python26\lib\urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "c:\python26\lib\urllib.py", line 344, in open_http
    h.endheaders()
  File "c:\python26\lib\httplib.py", line 904, in endheaders
    self._send_output()
  File "c:\python26\lib\httplib.py", line 776, in _send_output
    self.send(msg)
  File "c:\python26\lib\httplib.py", line 735, in send
    self.connect()
  File "c:\python26\lib\httplib.py", line 716, in connect
    self.timeout)
  File "c:\python26\lib\socket.py", line 514, in create_connection
    raise error, msg
IOError: [Errno socket error] [Errno 10060] A connection attempt
failed because
the connected party did not properly respond after a period of time,
or establis
hed connection failed because connected host has failed to respond

It should be like this:

SAT_URL =
"http://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg"
SAT_FILE = r"C:\latest_BWI_vis.jpg"
urllib.urlretrieve(SAT_URL, SAT_FILE)- Hide quoted text -

- Show quoted text -

It doesn't matter, the same error 10060 appears .

The connection problem has to do with the proxy settings.

In order for me to use Internet Explorer, the LAN's Automatic
configuration must be turned on and use a script found on the
company's proxy server. I was wondering how to get urllib.urlopen to
access the script on the proxy server.

Thanks for your help.

Kelly
 
K

kBob

kBob said:
kBob wrote:
 I created a script to access weather satellite imagery fron NOAA's
ADDS.
 It worked fine until recently with Python 2.6.
 The company changed the Internet LAN connections to "Accept Automatic
settings" and "Use automatic configuration script"
 How do you get urllib.urlopen to use the the "automatic script"
configuration?
 This code worked recently, until the company implemented these LAN
connections...
    SAT_URL = "http://adds.aviationweather.gov/data/satellite/
latest_BWI_vis.jpg"
    satpic = urllib.urlopen(SAT_URL, proxies=0 )
    satimg = satpic.read()
For the record, I got:
 >>> import urllib
 >>> SAT_URL =
"http://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg"
 >>> satpic = urllib.urlopen(SAT_URL, proxies=0 )
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\Python26\lib\urllib.py", line 79, in urlopen
     opener = FancyURLopener(proxies=proxies)
   File "C:\Python26\lib\urllib.py", line 617, in __init__
     URLopener.__init__(self, *args, **kwargs)
   File "C:\Python26\lib\urllib.py", line 129, in __init__
     assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
AssertionError: proxies must be a mapping
However, urllib.urlretrieve(...) works.- Hide quoted text -
- Show quoted text -
I saw that, but I still get the same error time out error ...
import urllib
SAT_URL = "http://adds.aviationweather.gov/data/satellite/"
SAT_FILE = "latest_BWI_vis.jpg"
satimg = urllib.urlretrieve( SAT_URL, SAT_FILE )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "c:\python26\lib\urllib.py", line 237, in retrieve
    fp = self.open(url, data)
  File "c:\python26\lib\urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "c:\python26\lib\urllib.py", line 344, in open_http
    h.endheaders()
  File "c:\python26\lib\httplib.py", line 904, in endheaders
    self._send_output()
  File "c:\python26\lib\httplib.py", line 776, in _send_output
    self.send(msg)
  File "c:\python26\lib\httplib.py", line 735, in send
    self.connect()
  File "c:\python26\lib\httplib.py", line 716, in connect
    self.timeout)
  File "c:\python26\lib\socket.py", line 514, in create_connection
    raise error, msg
IOError: [Errno socket error] [Errno 10060] A connection attempt
failed because
the connected party did not properly respond after a period of time,
or establis
hed connection failed because connected host has failed to respond
It should be like this:
SAT_URL =
"http://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg"
SAT_FILE = r"C:\latest_BWI_vis.jpg"
urllib.urlretrieve(SAT_URL, SAT_FILE)- Hide quoted text -
- Show quoted text -

It doesn't matter, the same error 10060 appears .

The connection problem has to do with the proxy settings.

 In order for me to use Internet Explorer, the LAN's Automatic
configuration must be turned on and use a script found on the
company's proxy server. I was wondering how to get urllib.urlopen to
access the script on the proxy server.

Thanks for your help.

Kelly- Hide quoted text -

- Show quoted text -

OK, looks like I need to start a new thread.....

How to get urllib to work with a Web Proxy Auto-Discovery Protocol
(WPAD)?

Kelly
 
J

John Nagle

I created a script to access weather satellite imagery fron NOAA's
ADDS.

It worked fine until recently with Python 2.6.

The company changed the Internet LAN connections to "Accept Automatic
settings" and "Use automatic configuration script"

How do you get urllib.urlopen to use the the "automatic script"
configuration?

This code worked recently, until the company implemented these LAN
connections...

SAT_URL = "http://adds.aviationweather.gov/data/satellite/
latest_BWI_vis.jpg"

Try

https://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg

The aviationweather.gov site will accept a HTTPS request.

Maybe that will bypass whatever lame web proxy is in the way.

John Nagle
 
L

Lawrence D'Oliveiro

In message
kBob said:
The company changed the Internet LAN connections to "Accept Automatic
settings" and "Use automatic configuration script"

Look at that configuration script, figure out what it’s returning for a
proxy, and put that into your Python script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,100
Latest member
MelodeeFaj
Top