How do I use Python to search and store data from the Stack Overflow API?

Asked

Viewed 307 times

2

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

3 answers

5

The Stack Exchange API is all Restful, meaning you only need to make HTTP requests for a given URL, and you get a JSON response. There is no official Python client, but Renan found one in Guthub. So I searched (I’m not a Python user), if you want to do it in the nail, just use the httplib (http.client in Python 3) to make the requests.

Documentation on all methods available in the API can be found at http://api.stackexchange.com/docs.

4

I’ll give you a data about the Stack Overflow: both here and in the English matrix people in general do not like questions asking for tutorials. There is even a standard reason for closing questions, when it comes to this.

This is just a hint. Since you will actually do a job on the subject, I will give you two sources:

If you have questions, both have some documentation. When you have a more specific problem, do not hesitate to open a question. But let it be a very specific problem, okay? Always do a little bit of Rubber ducking before.

  • So, my young friend. I believe you are mistaken in your interpretation of my problem. Yes it is a specific problem of programming, I need to know how to access the api using python, only it is not common as most who paste pieces of code with errors and ask for help with correction. The word "Tutorial" was used because I don’t really have a basis on the problem and would need a more complete answer. Anyway, thank you very much!

2

Beyond the answers of bfavaretto and of Renan, giving a quick search on Stackapps, found that question, linking to the pyso, that works properly for Python 2.6 and already provides various methods for data acquisition.

With a quick analysis of this lib, it is possible to verify that it was developed using urllib and urllib2 to make HTTP requests.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.