How to use Python to search and store Stack Overflow API data?

2

I need to develop a job to store data on Stack Overflow. I want to know how to access the Stack Exchange API with Python, and how to use the API.

    
asked by anonymous 27.05.2014 / 23:13

3 answers

5

The Stack Exchange API is all RESTful, that is, you just need to make HTTP requests for a particular URL, and you get a response in JSON. There is no official client for Python, but Renan found one on GutHub . From what I've researched (I'm not a Python user), if you want to do the nail, you'd just have to use httplib ( http.client in Python 3) to make the requests.

The documentation on all methods available in the API can be found at link .

    
27.05.2014 / 23:27
4

I'll give you some information about Stack Overflow: both here and in the matrix in English people generally do not like asking questions for tutorials. There is even a standard reason for closing questions when it comes to that.

That's just a tip. Since you will actually do some work on the subject, I will tell you two sources:

  • The official API: link . Note that the API is for Javascript;
  • Py-StackExchange: link . It is a UNOFFICIAL API for python. It actually integrates the official with Python.

If you have questions, both have some documentation. When you have a more specific problem, do not hesitate to open an issue. But that's a very specific problem, okay? Always make some rubber ducking before.

    
27.05.2014 / 23:28
2

In addition to the responses from bfavaretto and Renan , giving a quick search on StackApps , I found this question , linking to the pyso , which works correctly for Python 2.6 and already provides several methods for data acquisition.

With a quick review of this lib, you can see that it was developed using urllib and urllib2 to make HTTP requests.

    
02.06.2014 / 14:47