Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Invalid port number in request for secure site web page

Reply
Thread Tools

Invalid port number in request for secure site web page

 
 
jfdutcher1958
Guest
Posts: n/a
 
      10-19-2004

Python returns this message:

InvalidURL: nonnumeric port: '//www.a2webhosting.com:2083/frontend/x2'

in reponse to the call below ....but the port number looks
numeric ???

************************************************** *************
import sys, httplib
showlines = 56
try:
servername, filename = sys.argv[1:] # cmdline args?
except:
servername, filename
= 'https://www.a2webhosting.com:2083/frontend/x2', '/index.html'

print servername, filename




 
Reply With Quote
 
 
 
 
David M. Cooke
Guest
Posts: n/a
 
      10-19-2004
"jfdutcher1958" <(E-Mail Removed)> writes:

> Python returns this message:
>
> InvalidURL: nonnumeric port: '//www.a2webhosting.com:2083/frontend/x2'
>
> in reponse to the call below ....but the port number looks
> numeric ???
>
> ************************************************** *************
> import sys, httplib
> showlines = 56
> try:
> servername, filename = sys.argv[1:] # cmdline args?
> except:
> servername, filename
> = 'https://www.a2webhosting.com:2083/frontend/x2', '/index.html'
>
> print servername, filename


You've forgotten a line (the one which throws the error you've given).
But, I believe your problem is 'https://www....' is parsed as a
serverort pair: the server is https, and the port is //www..., which
of course is invalid.

I presume you're doing httplib.HTTPConnection(servername) (or
HTTPSConnection). You can't use a URL there. Usage from the docs is
like this:
>>> h1 = httplib.HTTPConnection('www.cwi.nl')
>>> h2 = httplib.HTTPConnection('www.cwi.nl:80')
>>> h3 = httplib.HTTPConnection('www.cwi.nl', 80)


Depending on what you're doing, you might be better off using the
urllib or urllib2 modules.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Secure your digital information assets with Secure Auditor. SecureWindows with Secure Auditor alannis.albert@googlemail.com Cisco 0 04-14-2008 06:53 AM
Secure your digital information assets with Secure Auditor SecureWindows with Secure Auditor alannis.albert@googlemail.com Cisco 0 04-14-2008 06:52 AM
List of free web site design, web site backgrounds, web site layoutsweb sites cyber HTML 1 12-19-2007 09:07 AM
Back button doesn't work when it is a secure page returning to a non secure page Miss Mary General Computer Support 1 09-21-2007 09:32 AM



Advertisments