**** httplib.InvalidURL: nonnumeric port ****

Chris Rebert clp2 at rebertia.com
Mon Dec 20 14:45:45 EST 2010


> On Tue, Dec 21, 2010 at 12:42 AM, Kev Dwyer <kevin.p.dwyer at gmail.com> wrote:
>> On Tue, 21 Dec 2010 00:01:44 +0530, Anurag Chourasia wrote:
>> >>> import httplib
>> >>> help(httplib.HTTP)
>> Help on class HTTP in module httplib:
>>
>> class HTTP
>>  |  Compatibility class with httplib.py from 1.5.
>>  |
>>  |  Methods defined here:
>>  |
>>  |  __init__(self, host='', port=None, strict=None)
>>
>> The constructor doesn't take a complete URL as an argument.
>>
>> Also, shouldn't you be using httplib.HTTPConnection?  The docs
>>  state that httplib.HTTP is for backward compatibility only.
>>
On Mon, Dec 20, 2010 at 11:30 AM, Anurag Chourasia
<anurag.chourasia at gmail.com> wrote:
> Hi Kevin,
> Thanks for the response.
> I tried with HTTPConnection but the same problem.
>>>> h1 =
>>>> httplib.HTTPConnection('http://joule:8041/DteEnLinea/ws/EnvioGuia.jws')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/u01/home/apli/wm/python241/lib/python2.4/httplib.py", line 582, in
> __init__
>     self._set_hostport(host, port)
>   File "/u01/home/apli/wm/python241/lib/python2.4/httplib.py", line 594, in
> _set_hostport
>     raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
> httplib.InvalidURL: nonnumeric port: '8041/DteEnLinea/ws/EnvioGuia.jws'
> Do i need to use some other library to be able to send XML Data (and get a
> response back) to this Kind of Web Service address
> i.e. http://joule:8041/DteEnLinea/ws/EnvioGuia.jws ?
> Regards,
> Anurag

(1) Please avoid top-posting
(2) Did you read the other part of Kev's comment? "The constructor
doesn't take a complete URL as an argument." You must pass only the
domain to the constructor and then call .request() on the
HTTPConnection object.
(3) If you're using SOAP, try https://fedorahosted.org/suds/

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list