What Python tools can I use to interface with a website API?

Let's say I wanted to create a python script interface with a site like Twitter.

What will I use for this? I'm used to using curl / wget from bash, but Python seems to be much nicer to use. What is equivalent?

(This is not Python running from a web server, but executed locally via the command line)

+6
python web-services twitter
source share
5 answers

Something like Twitter, you will save a ton of time without reinventing the wheel. Try a library like python-twitter . This way you can write your own script or even a full-fledged application that interacts with Twitter, and you do not need to worry about implementation details.

If you want to flip your own interface library, you will need to get to know urllib and depending on what format they provide results, lxml (or some other xml parser) or simplejson .

+8
source share

Python has urllib2, which is an extensible library for opening URLs.

Full-featured easy-to-use library.

https://docs.python.org/library/urllib2.html

+5
source share

I wholeheartedly recommend mechanize for python. This is a finely programmable web browser that you can use with python that also processes forms and cookies! This makes any website crawl a breeze.

Take a look at examples of this link to see what it can do.

+4
source share

Python has a very nice httplib module, as well as a url module, which together will probably do most of what you need (at least with regard to wget functions).

+2
source share

If you are used to working with cURL, consider PycURL .

0
source share

All Articles