Tags: access, coding, password, programming, python, scripts, urllib2, user, username, website

How can to post the username and password to a website?

On Programmer » Python

1,989 words with 2 Comments; publish: Fri, 04 Jan 2008 21:45:00 GMT; (20062.50, « »)

Hi, now i used Python 2.5 for coding the scripts to access to a website. I try to use the urllib2. But i don't know how to post the user name and the password to the login form. So, please show me how must i do?

Thanks,

All Comments

Leave a comment...

  • 2 Comments
    • Quote:
      === Original Words ===

      URLopener and FancyURLopener objects have the following attributes.

      prompt_user_passwd( host, realm)

      Return information needed to authenticate the user at the given host in the specified security realm. The return value should be a tuple, (user, password), which can be used for basic authentication.

      The implementation prompts for this information on the terminal; an application should override this method to use an appropriate interaction model in the local environment.

      #1; Fri, 04 Jan 2008 21:46:00 GMT
    • Quote:
      === Original Words ===

      This section of the documentation looks promising:

      thanks so much, but can u show me a ex. code to login to a website by post method.

      Please,

      #2; Fri, 04 Jan 2008 21:47:00 GMT