Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#835 closed defect (invalid)

Urllib problem connect to oscam webif

Reported by: Bruty Owned by:
Priority: major Component: General
Severity: medium Keywords:
Cc: Sensitive: no

Description

There is an error when if I try save web into html using python func urllib or urllib2 - login, pass defined, without login,pass all ok

Here is log:
root@dm800:/tmp# python test3.py
Traceback (most recent call last):

File "test3.py", line 9, in <module>

file = urllib2.urlopen("http://user:heslo@127.0.0.1:8888/status.html")

File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen

return _opener.open(url, data, timeout)

File "/usr/lib/python2.6/urllib2.py", line 389, in open

response = self._open(req, data)

File "/usr/lib/python2.6/urllib2.py", line 407, in _open

'_open', req)

File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain

result = func(*args)

File "/usr/lib/python2.6/urllib2.py", line 1146, in http_open

return self.do_open(httplib.HTTPConnection, req)

File "/usr/lib/python2.6/urllib2.py", line 1121, in do_open

raise URLError(err)

urllib2.URLError: <urlopen error [Errno 7] no address associated with hostname.>
root@dm800:/tmp#

Change History (4)

comment:1 by alno, 14 years ago

Resolution: invalid
Status: newclosed
<urlopen error [Errno 7] no address associated with hostname.>

This has nothing todo with oscam!

comment:2 by Bruty, 14 years ago

Resolution: invalid
Status: closedreopened

Traceback (most recent call last):

File "test3.py", line 9, in <module>

file = urllib.urlopen("http://user:heslo@127.0.0.1:8888/status.html")

File "/usr/lib/python2.6/urllib.py", line 87, in urlopen

return opener.open(url)

File "/usr/lib/python2.6/urllib.py", line 206, in open

return getattr(self, name)(url)

File "/usr/lib/python2.6/urllib.py", line 361, in open_http

return self.http_error(url, fp, errcode, errmsg, headers)

File "/usr/lib/python2.6/urllib.py", line 374, in http_error

result = method(url, fp, errcode, errmsg, headers)

File "/usr/lib/python2.6/urllib.py", line 682, in http_error_401

errcode, errmsg, headers)

File "/usr/lib/python2.6/urllib.py", line 384, in http_error_default

raise IOError, ('http error', errcode, errmsg, headers)

IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x53d328>)

comment:3 by alno, 14 years ago

Resolution: invalid
Status: reopenedclosed

would you be so kind and study your pyton docs how an authentication works with this language? Credenticals within adress may be allowed in some browsers but not in pyton. I have googled a bit for you and a good page for you could be http://docs.python.org/library/urllib.html especially 20.5.3. URL Opener objects

Note: See TracTickets for help on using tickets.