post method in Python - python

I want to write a script in Python that would connect and post some data to several web-servers automatically.
Please write how to post and submit data for example to google. Just can't understand how to do it from Python documentation. Thank You.

Check the documentation on the urllib2 module and check out this urllib2 the missing manual. It's all there.

If you are open for packages outside standard library, then mechanize is a good option for such tasks.

Related

How I could download a single post by url using instaloader?

I have a problem with python library instaloader, this one is really cool but I can`t find a method to download a post by url or post id. Everything I have found is terminal command in official documentation.
instaloader -- -B_K4CykAOtf
But this isn`t my decision, I need a way to use it in script. Hope somebody know answer, thank for attention
instaloader -- -B_K4CykAOtf

How can I download information from a website if it returns XML/JSON in its response?

Does Python3 have a built in method to do this? Any guidance at all would be great! :)
The website in question exposes all of its information and even gives you an API key to use.
Python includes a json module that can do the conversion for you. For downloading the actual data from the web site, use urllib.request.

How can I use Python with Mechanize for posting multipart/form-data?

I am using http://pypi.python.org/pypi/mechanize/0.1.11 for programmatic web browsing, I want to be able to upload files to servers the same way the browser does (by sending the content as multipart/form-data, defined in RFC2388)
Is this possible with mechanize, can you show me an example?
Thanks!
There's a couple of good answer on this SO question, one with bare mechanize and one with twill on top of it, and I believe they both end up sending multipart/form-data as you want.

Is there a python library that implements both sides of the AWS authentication protocol?

I am writing a REST service in python and django and wanted to use Amazon's AWS authentication protocol. I was wondering if anyone knew of a python library that implemented formation of the header for sending and the validation of the header for recieving?
Try this Library. I think it is the library you are searching for..
CalNet
You can find some Python Code Samples Here
boto is a Python library for AWS. I don't know however if it supports what you are asking for.
I think this code does exactly what you want :)
I'll be happy to get comments for improvement if needed.

import mechanize module to python script

I tried to import mechanize module to my python script like this,
from mechanize import Browser
But, Google appengine throws HTTP 500 when accessing my script.
To make things more clear, Let me give you the snapshot of my package structure,
root
....mechanize(where all the mechanize related files there)
....main.py
....app.yaml
....image
....script
Can anyone help me out to resolve this issue?
Thanks,
Ponmalar
The mechanize main page says:
mechanize.Browser is a subclass of mechanize.UserAgentBase, which is, in turn, a subclass of urllib2.OpenerDirector
My understanding is that urllib2 is one of the sandboxed modules in GAE, with its functionality being replaced by the Google-provided urlfetch. You'd need to re-implement the mechanize.UserAgentBase class to use urlfetch, if that's at all possible.
When GAE throws a 500, you can see the actual error in the logs on your admin console. If that doesn't help, paste it here and we'll help further.
Also, does it work on the dev_appserver?

Categories

Resources