|
1 | | -python-500px |
2 | | -====== |
3 | | -A Python client for 500px API, inspired by tweepy(https://github.com/tweepy/tweepy), python-instagram(https://github.com/Instagram/python-instagram) |
| 1 | +# python-500px |
4 | 2 |
|
5 | | -Installation |
6 | | ----- |
7 | | -pip install python-500px |
| 3 | +A Python client for 500px API ( https://github.com/500px/api-documentation ). |
8 | 4 |
|
9 | | -Requires |
10 | | ----- |
| 5 | +this library was inspired by tweepy(https://github.com/tweepy/tweepy), python-instagram(https://github.com/Instagram/python-instagram) |
| 6 | + |
| 7 | +*** |
| 8 | + |
| 9 | +## Installation |
| 10 | + pip install python-500px |
| 11 | + |
| 12 | +## Requires |
11 | 13 | * httplib2 |
12 | 14 | * simplejson |
13 | 15 |
|
14 | | -Usage |
15 | | ----- |
| 16 | +## Usage |
| 17 | + |
16 | 18 | from fivehundredpx.client import FiveHundredPXAPI |
17 | 19 | from fivehundredpx.auth import * |
18 | 20 |
|
|
22 | 24 | handler.set_access_token(OAUTH_TOKEN,OAUTH_TOKEN_SECRET) |
23 | 25 | api = FiveHundredPXAPI(handler) |
24 | 26 | api.users() |
25 | | - |
26 | | -Methods |
27 | | ----- |
| 27 | + |
| 28 | +## Authentication |
| 29 | + |
| 30 | +- ** initialize ** |
| 31 | + |
| 32 | +-- |
| 33 | + handler = OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET) |
| 34 | + |
| 35 | +- **handler.get_authorization_url()** - get a url for authorization. **[authorize][]** |
| 36 | +- **handler.get_access_token(verifier)** - get an access token. **[access_token][]** |
| 37 | + |
| 38 | +-- |
| 39 | + token = handler.get_access_token(verifier) |
| 40 | + print "this is your access token:\n%s" % token.key |
| 41 | + print "this is your access token secret:\n%s" % token.secret |
| 42 | + |
| 43 | +- **handler.get_xauth_access_token(username,password)** - get an access token by using xAuth. |
| 44 | + |
| 45 | + |
| 46 | +## Methods |
| 47 | + |
28 | 48 | * api.photos() |
29 | 49 | * api.photos_search() |
30 | 50 | * api.photos_id() |
@@ -60,3 +80,9 @@ Methods |
60 | 80 |
|
61 | 81 | please check test.py |
62 | 82 |
|
| 83 | + |
| 84 | +[authorize]: https://github.com/500px/api-documentation/blob/master/authentication/POST_oauth_authorize.md |
| 85 | +[request_token]: https://github.com/500px/api-documentation/blob/master/authentication/POST_oauth_requesttoken.md |
| 86 | +[access_token]: https://github.com/500px/api-documentation/blob/master/authentication/POST_oauth_accesstoken.md |
| 87 | + |
| 88 | + |
0 commit comments