You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
View more detailed documentation [here](docs/README.md)
4
5
5
-
Clever is moving to a community supported model with our client libraries. We will still respond to and merge incoming PRs but are looking to turn over ownership of these libraries to the community. If you are interested, please contact our partner-engineering team at [email protected].
6
+
## Requirements.
6
7
7
-
## Installation
8
+
Python 2.7 and 3.4+
8
9
10
+
## Installation
9
11
From PyPi:
10
12
11
13
```bash
@@ -24,92 +26,80 @@ Or from source:
24
26
$ python setup.py install
25
27
```
26
28
27
-
## Usage
28
-
29
-
Get started by importing the `clever` module and setting your authentication method:
30
-
29
+
Then import the package:
31
30
```python
32
-
import clever
33
-
clever.set_token('YOUR_OAUTH_TOKEN')
34
-
# or if you're using API key auth
35
-
# clever.set_api_key('YOUR_API_KEY')
31
+
import clever
36
32
```
37
33
38
-
The `clever` module exposes classes corresponding to resources:
39
-
40
-
* Contact
41
-
* District
42
-
* DistrictAdmin
43
-
* School
44
-
* SchoolAdmin
45
-
* Section
46
-
* Student
47
-
* Teacher
48
-
* Event
34
+
## Getting Started
49
35
50
-
Each exposes a class method `all` that returns a list of all data in that resource that you have access to. Keyword arguments correspond to the same query parameters supported in the HTTP API, except that `limit` and `page` are not supported (pagination is handled automatically).
36
+
Please follow the [installation procedure](#installation) and then run the following:
51
37
52
38
```python
53
-
schools = clever.School.all() # gets information about all schools you have access to
54
-
schools = clever.School.all(where=json.dumps({'name': 'Of Hard Knocks'}))
55
-
schools = clever.School.all(sort='state')
56
-
```
39
+
from__future__import print_function
40
+
import time
41
+
import clever
42
+
from clever.rest import ApiException
43
+
from pprint import pprint
57
44
58
-
If you'd like more control over pagination, or to limit the number of resources returned, use the `iter` class method:
45
+
# Note: This is hard coded for demo purposes only. Keep your access tokens secret!
The `retrieve` class method takes in a Clever ID and returns a specific resource. The object (or list of objects in the case of `all`) supports accessing properties using either dot notation or dictionary notation:
55
+
try:
56
+
api_response = api_instance.get_students()
57
+
for student in api_response.data:
58
+
pprint(student.data.id)
59
+
except ApiException as e:
60
+
print("Exception when calling DataApi->get_students: %s\n"% e)
API request to https://api.clever.com/v1.1/districts returned (response code, response body) of (200, '{"data":[{"data":{"name":"Demo District","id":"4fd43cc56d11340000000005"},"uri":"/v1.1/districts/4fd43cc56d11340000000005"}],"links":[{"rel":"self","uri":"/v1.1/districts"}]}')
0 commit comments