The Artima Developer Community
Sponsored Link

Python Answers Forum
How to execute a long/Big http request using post method of

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Manish Tiwari

Posts: 1
Nickname: mktpython
Registered: Jun, 2009

How to execute a long/Big http request using post method of Posted: Jun 10, 2009 2:58 AM
Reply to this message Reply
Advertisement
Hi All,

I am very new to python.

I have to execute some https requests using python scripts.

I am using the below code:

------------------------------------------------------------------
#!/us r/bin/python
import urllib2,sys
from google.appengine.api import urlfetch
our_url = str(sys.argv[1])
username = str(sys.argv[2])
password = str(sys.argv[3])
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, our_url, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
try: file_handle = urlfetch.fetch(url=our_url,method=urlfetch.POST)
except IOError, e:
print 'ERROR_REASON:', e.reason
else:
print file_handle.read()

-----------------------------------------------

Its working fine with normal length http requests.

But in my requirement some https request are of about 1000, 10000 characters, and teh above code is not able to execute the same.

I have to use some post mechanism for the same.

Can anyone please help me regarding this.

Any help is highly appreciated.

Best Regards,
Manish

Topic: string to variable name Previous Topic   Next Topic Topic: Data Entry Using Python

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use