Skip to content

Commit ecfaa5a

Browse files
committed
Updated read me
1 parent 1836db6 commit ecfaa5a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,30 @@ Python API client for StackExchange APIv2.1
77
## Installation
88

99
### To Run
10-
pip install pystex
10+
pip install pystex
1111

1212
### To Develop
1313
Nothing specific now
1414

1515
## Usage
1616

17-
from pystex import Stackexchange
17+
from pystex import Stackexchange
1818
from pystex import APIError
1919

20-
client = Stackexchange({Your API Key})
20+
client = Stackexchange({Your API Key})
2121

2222
try:
23-
result = client.users.get()
23+
result = client.users.get()
2424
except APIError as e:
25-
print e
25+
print e
26+
27+
In case of having variables for API calling. For example:
28+
29+
http://api.stackexchange.com/2.1/tags/python/top-answerers/all_time?pagesize=30&site=stackoverflow
30+
31+
Please note the API **tags/{tag}/top-answerers** allow a tag to be a variable. In such cases. It's safe to use `__getattr__()` directly. The pystex for above example will be:
32+
33+
skill = 'python'
34+
result = api_client.tags.__getattr__(skill).__getattr__('top-answerers').all_time.get(pagesize=30, page=1)
35+
36+
It's also worth to note API url with hyphen isn't allowed in Python language, thus `__getattr__()` was used.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name='pystex',
17-
version='0.0.18',
17+
version='0.0.19',
1818
description='Python StackExchange API Client',
1919
author='Steven Cheng',
2020
author_email='[email protected]',

0 commit comments

Comments
 (0)