Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: How to login https sever with inputing account name and password?
Steve Holden
3/4/2010 4:32:00 PM
Karen Wang wrote:
> Hi all,
>
> I want to use python to access to https server, like
> â??
https://212.218.229.10/chinate...
>
> If open it from IE, will see the pop-up login windows like this
>
> I tried several ways but always only get page forâ? HTTP Error 401.2 â??
> Unauthorizedâ? error. ( myusername and mypassword are all correct)
>
> Below is my code:
>
> import urllib2
>
> values = {
>
> 'user' : "myusername",
>
> â??pass' : "mypassword" }
>
> data = urllib2.urlencode(values)
>
> t = urllib2.urlopen('
https://212.218.229.10/chinatest/...
)
>
> print t.read()
>
> where I am wrong ?
>
Read the HTTP standard. The authentication data has to be send as HTTP
headers, not as the data to a POST request. The dialog box you see is
the browser attempting to collect the data it needs to put in the header.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010
http://us....
Holden Web LLC
http://www.hold...
UPCOMING EVENTS:
http://holdenweb.event...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: How to login https sever with inputing account name and password?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password