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

  • Home
  • SEARCH
  • 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 135457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:47:36+00:00 2026-05-11T06:47:36+00:00

I am currently trying to log into a site using Python however the site

  • 0

I am currently trying to log into a site using Python however the site seems to be sending a cookie and a redirect statement on the same page. Python seems to be following that redirect thus preventing me from reading the cookie send by the login page. How do I prevent Python’s urllib (or urllib2) urlopen from following the redirect?

  • 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. 2026-05-11T06:47:37+00:00Added an answer on May 11, 2026 at 6:47 am

    You could do a couple of things:

    1. Build your own HTTPRedirectHandler that intercepts each redirect
    2. Create an instance of HTTPCookieProcessor and install that opener so that you have access to the cookiejar.

    This is a quick little thing that shows both

    import urllib2  #redirect_handler = urllib2.HTTPRedirectHandler()  class MyHTTPRedirectHandler(urllib2.HTTPRedirectHandler):     def http_error_302(self, req, fp, code, msg, headers):         print 'Cookie Manip Right Here'         return urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)      http_error_301 = http_error_303 = http_error_307 = http_error_302  cookieprocessor = urllib2.HTTPCookieProcessor()  opener = urllib2.build_opener(MyHTTPRedirectHandler, cookieprocessor) urllib2.install_opener(opener)  response =urllib2.urlopen('WHEREEVER') print response.read()  print cookieprocessor.cookiejar 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 200k
  • Answers 200k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is a response to my own previous post. Got… May 12, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer Reposting this answer: NOLOCK means placing no locks at all.… May 12, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer In ASP.NET MVC, use <a href='<%=Url.Action("Login")%>'>login</a> it will automatically generate… May 12, 2026 at 7:55 pm

Related Questions

I'm a total newbie when it comes to CSS so I've pretty much given
I joined a new company about a month ago. The company is rather small
After choosing Apache Subversion for my version control needs (and AnkhSVN / TortoiseSVN for
We are trying to set up a cursor to run through records generated from

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.