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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:33:00+00:00 2026-05-26T03:33:00+00:00

I have some test code (as a part of a webapp) that uses urllib2

  • 0

I have some test code (as a part of a webapp) that uses urllib2 to perform an operation I would usually perform via a browser:

  • Log in to a remote website
  • Move to another page
  • Perform a POST by filling in a form

I’ve created 4 separate, clean virtualenvs (with –no-site-packages) on 3 different machines, all with different versions of python but the exact same packages (via pip requirements file), and the code only works on the two virtualenvs on my local development machine(2.6.1 and 2.7.2) – it won’t work on either of my production VPSs

In the failing cases, I can log in successfully, move to the correct page but when I submit the form, the remote server replies telling me that there has been an error – it’s an application server error page (‘we couldn’t complete your request’) and not a webserver error.

  • because I can successfully log in and maneuver to a second page, this doesn’t seem to be a session or a cookie problem – it’s particular to the final POST
  • because I can perform the operation on a particular machine with the EXACT same headers and data, this doesn’t seem to be a problem with what I am requesting/posting
  • because I am trying the code on two separate VPS rented from different companies, this doesn’t seem to be a problem with the VPS physical environment
  • because the code works on 2 different python versions, I can’t imagine it being an incompabilty problem

I’m completely lost at this stage as to why this wouldn’t work. I’ve even ‘turned-it-off-and-turn-it-on-again’ because I just can’t see what the problem could be.

I think it has to be something to do with the final POST coming from a VPS that the remote server doesn’t like, but I can’t figure out what that could be. I feel like there is something going on under the hood of URLlib that is causing the remote server to dislike the reply.

EDIT
I’ve installed the exact same Python version (2.6.1) on the VPS as is on my working local copy and it doesn’t work remotely, so it must be something to do with originating from a VPS. How could this effect the Http request? Is it something lower level?

  • 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-26T03:33:01+00:00Added an answer on May 26, 2026 at 3:33 am

    Well, it looks like I know why the problem was happening, but I’m not 100% the reason for it.

    I simply had to make the server wait (time.sleep()) after it sent the 2nd request (Move to another page) before doing the 3rd request (Perform a POST by filling in a form).

    I don’t know is it because of a condition with the 3rd party server, or if it’s some sort of odd issue with URLlib? The reason it seemed to work on my development machine is presumably because it was slower then the server at running the code?

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

Sidebar

Related Questions

I have some code that attempts to test whether my application is running with
This is a minimal test case of some code that I actually have. It
I have some code I need to write a test for that connects to
I have some code that uses some shared libraries (c code on gcc). When
Does anyone have some good hints for writing test code for database-backend development where
I have some code in my error handler I need to test against a
I have some basic PHP code: $raceramps56[short] = My Test Product; $leftMenu = '<div
I have some useful wpf buttons to test some functionality. It would be good
i have some html files as part of a regular website that has been
I have a class library assembly and some test code. Because the test code

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.