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
Copy file name to clipboardExpand all lines: README.md
+38-67Lines changed: 38 additions & 67 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
-
# Clever Python bindings
1
+
# Clever - the Python library for the Clever API
2
2
3
-
## Maintenance
3
+
## API Documentation
4
+
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 tech-support@clever.com.
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,97 +26,66 @@ 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')
31
+
import clever
34
32
```
35
33
36
-
The `clever` module exposes classes corresponding to resources:
34
+
## Getting Started
37
35
38
-
* Contact
39
-
* District
40
-
* DistrictAdmin
41
-
* School
42
-
* SchoolAdmin
43
-
* Section
44
-
* Student
45
-
* Teacher
46
-
* Event
47
-
48
-
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:
49
37
50
38
```python
51
-
schools = clever.School.all() # gets information about all schools you have access to
52
-
schools = clever.School.all(where=json.dumps({'name': 'Of Hard Knocks'}))
53
-
schools = clever.School.all(sort='state')
54
-
```
39
+
from__future__import print_function
40
+
import time
41
+
import clever
42
+
from clever.rest import ApiException
43
+
from pprint import pprint
44
+
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:
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