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

The Archive Base Latest Questions

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

using the following snip of code to access a url with a post. i

  • 0

using the following snip of code to access a url with a post.

i can get it using wget and the following:
wget –post-data ‘p_calling_proc=bwckschd.p_disp_dyn_sched&p_term=201010’ https://spectrumssb2.memphis.edu/pls/PROD/bwckgens.p_proc_term_date

for some reason, i’m having an issue with my python text, in that i get a errorcode of 400. (and of course the browser works as expected)

any thoughts/comments/etc…

the python test that i have:

//==========================================

import urllib 
import urllib2
import sys, string
import time
import mechanize

Request = urllib2.Request
urlopen = urllib2.urlopen

headers ={'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}
query = "p_calling_proc%3Dbwckschd.p_disp_dyn_sched%26p_term%3D201010"
url1="https://spectrumssb2.memphis.edu/pls/PROD/bwckgens.p_proc_term_date"

req = Request(url1, query, headers)

test1=0
test=0
while test==0:
  print "aaaaattttt \n"
  try: 
    res = urlopen(req)
    #req = Request(url1, query, headers)
    print "aaaappppp \n"
    #urllib2.URLError, (e)
    #print e
  except urllib2.HTTPError, e:
    print "ffff1111 "+str(e.code)+"\n"
    if e.code:
      test1=1
      print "error ..sleep \n"
      time.sleep(1)
    else:
      test1=0
  except urllib2.URLError, e:
    print e.reason
    #print "ffff3333 "+e.code+"\n"
    if e.reason:
      test1=1
      print "error ..sleep \n"
      time.sleep(1)
    else:
      test1=0
  #print "ddd "+e.code +"\n"
  #print e
  if test1==0:
    test=1

print "test1 = "+str(test1)+"\n"
#res = urlopen(req)
print "gggg 000000000000\n"
s = res.read()

.


any thoughts/comments would be appreciated..

thanks

  • 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-13T09:07:51+00:00Added an answer on May 13, 2026 at 9:07 am

    Try not encoding the query string. The &’s and =’s in the POST data don’t need to be urlencoded. If the web app on the remote end does not expect the %xx encoding in the query string, it won’t be able to parse it.

    Here’s curl’s HTTP request headers:

    POST / HTTP/1.1
    User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
    Host: 127.0.0.1 
    Accept: */*
    Content-Length: 188
    Expect: 100-continue
    
    bwckschd.p_disp_dyn_sched&p_term=201010
    

    And here’s the HTTP request headers from your python:

    POST / HTTP/1.1
    Accept-Encoding: identity
    Content-Length: 60
    Host: 127.0.0.1
    Content-Type: application/x-www-form-urlencoded
    Connection: close
    User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)
    
    p_calling_proc%3Dbwckschd.p_disp_dyn_sched%26p_term%3D201010
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to get bitmap from url. This function is used
I have the following code: $.ajax({ type: GET, url: /Search/GetNewData //Controller/ActionMethod ---snip--- )}; This
Using following code I try to get updated list of checkbuttons' corresponding text values,
I am trying to make following snip of code lockless using interlocked operations, Any
Using following regexp I can get if a string starts with a or b
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I am using following code for showing a MessageBox with ok and cancel button.
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am using following plugin http://pinesframework.org/pnotify/ I am creating dialog using following jquery 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.