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 6913525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:13:48+00:00 2026-05-27T09:13:48+00:00

When I try to post data from http to https, urllib2 does not return

  • 0

When I try to post data from http to https, urllib2 does not return desired https webpage instead website asks to enable cookies.

To get first http page:

    proxyHandler = urllib2.ProxyHandler({'http': "http://proxy:port" })
    opener = urllib2.build_opener(proxyHandler)
    opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0')]
    urllib2.install_opener(opener)
    resp = urllib2.urlopen(url)
    content = resp.read()

When I extract data from above page and post data to second https page, urllib2 returns success status 200 and page asks to enable cookies.

I’ve checked the post data, its fine. I’m getting cookies from website but not sure whether they are being sent with next request or not as I read in python docs that urllib2 automatically handles cookies.

To get second https page:

    resp = urllib2.urlopen(url, data=postData)
    content = resp.read()

I also tried to set proxy handler to this as read in a reply to similar problem on stackoverflow somewhere but got same result:

    proxyHandler = urllib2.ProxyHandler({'https': "http://proxy:port" })
  • 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-05-27T09:13:48+00:00Added an answer on May 27, 2026 at 9:13 am

    urllib2 “handles” cookies in responses but it doesn’t not automatically store them and resend them with later requests. You’ll need to use the cooklib module for that.

    There are some examples in the documentation that show how it works with urllib2.

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

Sidebar

Related Questions

Recently, I made a post about the developers I'm working with not using try
I am making a page that accepts post data from any number of pages
Usually when I get POST data it's send from a HTML form and the
Retrieving data from the REST Server works well, but if I want to post
I am using urllib2 to post data to a form. The problem is that
I am trying to send the POST data from java to a PHP page.
HttpRequestValidationException occurs when I try post when txtBulletin contains any HTML, like Hello<br />World
Every time I try to post to twitter in my rails app, the first
I could try to post and explain the exact query I'm trying to run,
I have a POST controller action like: if (ModelState.IsValid) { try { //.. save

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.