https://github.com/stared/se-api-py
A lightweight Python wrapper for StackExchange API v2.1
https://github.com/stared/se-api-py
Last synced: 5 months ago
JSON representation
A lightweight Python wrapper for StackExchange API v2.1
- Host: GitHub
- URL: https://github.com/stared/se-api-py
- Owner: stared
- Created: 2012-11-18T01:41:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-10T23:03:49.000Z (over 12 years ago)
- Last Synced: 2025-01-11T05:33:54.180Z (6 months ago)
- Language: Python
- Size: 130 KB
- Stars: 4
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
se-api-py
=========A lightweight Python wrapper for [StackExchange API](http://api.stackexchange.com/) v2.1.
Build with [Requests](http://docs.python-requests.org/).General philosophy of usage:
* se.fetch\[_one\](command, **parameters)
* parameters as in the documentation
* in the command, "{something}" and "{somethings}" are treated as placeholders for an int/str or a list of int/str, respectivelyExample of usage:
import SEAPI
se = SEAPI.SEAPI()
some_users = se.fetch_one("users/{ids}", ids=[1,3,7,9,13], site="stackoverflow")all_user = se.fetch("users", site="academia")
Alternatively, you can initialize SEAPI with default options, typically - site name, e.g.
so = SEAPI.SEAPI(site="stackoverflow")
some_questions = so.fetch("questions", page_limit=10)
# except for very small sites, you want to set page limitsome_sorted_posts = so.fetch_one("posts", order="desc", sort="votes")
# for sorting sometimes asking for more that one results in "throttle violation"If you want to diagnose a problem, or avoid it:
so.last_call
# lookup at the last command sentso.last_status
# check the last response statusslow_food = so.fetch("tags", min_delay=0.5)
# or set delay (by default it's 0.05)