Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:52:57+00:00 2026-06-13T16:52:57+00:00

This is the module that I’m trying to use and there is a form

  • 0

This is the module that I’m trying to use and there is a form I’m trying to fill automatically. The reason I’d like to use Requests over Mechanize is because with Mechanize, I have to load the login page first before I can fill it out and submit, whereas with Requests, I can skip the loading stage and go straight to POSTing the message (hopefully). Basically, I’m trying to make the login process consume as little bandwidth as possible.

My second question is, after the login process and the redirection, is it possible to not fully download the whole page, but to only retrieve the page title? Basically, the title alone will tell me if the login succeeded or not, so I want to minimize bandwidth usage.

I’m kind of a noob when it comes to HTTP requests and whatnot, so any help would be appreciated. FYI, this is for a school project.

edit The first part of the question has been answered. My question now is for the second part

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:52:59+00:00Added an answer on June 13, 2026 at 4:52 pm

    Some example code:

    import requests
    
    URL = 'https://www.yourlibrary.ca/account/index.cfm'
    payload = {
        'barcode': 'your user name/login',
        'telephone_primary': 'your password',
        'persistent': '1'  # remember me
    }
    
    session = requests.session()
    r = requests.post(URL, data=payload)
    print r.cookies
    

    The first step is to look at your source page and identify the form element that is being submitted (use Firebug/Chrome/IE tools whatever (or just looking at the source)). Then find the input elements and identify the required name attributes (see above).

    The URL you provided happens to have a “Remember Me”, which although I haven’t tried (because I can’t), implies it’ll issue a cookie for a period of time to avoid further logins — that cookies is kept in the request.session.

    Then just use session.get(someurl, ...) to retrieve pages etc…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method in a url rewriting module that looks like this public
I have this nifty PAM module that validates each session (like a desktop session)
I have a function in a module that looks something like this: module MyLibrary
I have this problem. I have a module (module 1) that use Nhibernate to
I have this module pattern that stores a bunch of vars. I want to
I'm writing a module that has several methods. Let's consider this : package MyPackage;
I'm aware that this is possible with the os module's os.system(color) function, but this
I need some like this: module One def test; puts 'Test One'; end end
Drupal 6.x I have this module that manages four different content types. For that
i've got a module that wants to use data provided by the class that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.