Invalid port number in request for secure site web page

D

David M. Cooke

jfdutcher1958 said:
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
server:port 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:
Depending on what you're doing, you might be better off using the
urllib or urllib2 modules.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top