Skip to content

Commit dc8643a

Browse files
committed
Merge pull request #16 from hfaran/develop
Add Piazza abstraction on top of PiazzaRPC
2 parents dbaef69 + b82d853 commit dc8643a

File tree

6 files changed

+698
-374
lines changed

6 files changed

+698
-374
lines changed

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,48 @@
22

33
Unofficial Client for Piazza's Internal API
44

5-
## Example
5+
## Setup
6+
7+
```bash
8+
git clone https://github.com/hfaran/piazza-api
9+
cd piazza-api
10+
sudo python setup.py install
611
```
12+
13+
## Examples
14+
15+
Some examples to get started; more in the documentation (which is coming soon;
16+
but the code is all Sphinx style documented and is fairly readable).
17+
18+
```python
719
>>> from piazza_api import Piazza
8-
>>> p = Piazza("hl5qm84dl4t3x2")
9-
>>> p.user_auth()
20+
>>> p = Piazza()
21+
>>> p.user_login()
1022
Email: ...
1123
Password: ...
12-
>>> p.get_post(181)
13-
...
14-
>>> p.enroll_students(["[email protected]", "[email protected]"])
24+
>>> user_profile = p.get_user_profile()
25+
>>> eece210 = p.network("hl5qm84dl4t3x2")
26+
>>> eece210.get_post(100)
1527
...
28+
>>> posts = eece210.iter_all_posts(limit=10)
29+
>>> for post in posts:
30+
... do_awesome_thing(post)
31+
>>> users = eece210.get_users(["userid1", "userid2"])
32+
>>> all_users = eece210.get_all_users()
1633
```
1734

18-
## Dependencies
35+
You can also use the "internal" PiazzaRPC class which maps more directly
36+
to Piazza's API itself but is not as nice and as intuitive to use as the
37+
`Piazza` class abstraction.
1938

20-
* [requests](http://python-requests.org/)
39+
```python
40+
>>> from piazza_api.rpc import PiazzaRPC
41+
>>> p = PiazzaRPC("hl5qm84dl4t3x2")
42+
>>> p.user_login()
43+
Email: ...
44+
Password: ...
45+
>>> p.content_get(181)
46+
...
47+
>>> p.add_students(["[email protected]", "[email protected]"])
48+
...
49+
```

0 commit comments

Comments
 (0)