Client library for Apereo OpenLRW API
Project description
# OpenLRW Python API Client
> A Python Client making your scripts for OpenLRW easier
<p align="center">
<a href='https://www.python.org/dev/peps/pep-0008/'><img src="https://img.shields.io/badge/code%20style-pep8-orange.svg" alt="code style pep 8"></a>
<a href="https://badge.fury.io/py/openlrw"><img src="https://badge.fury.io/py/openlrw.svg" alt="PyPI version"></a>
</p>
## Getting Started
` pip install openlrw `
## Usage
#### 1. Interacting with the User collection
```python
from openlrw.client import OpenLRW
from openlrw.exceptions import ExpiredTokenException
OpenLrw = OpenLRW(uri, username, password) # Create an instance of the client
jwt = OpenLrw.generate_jwt() # Generate a JSON Web Token for using OneRoster routes
# 1. Get the user john_doe
try:
user = OpenLrw.get_user('john_doe', jwt)
except ExpiredTokenException:
OpenLRW.pretty_error("Error", "JWT Expired")
# 2. Get all the users
try:
users = OpenLrw.get_users(jwt)
except ExpiredTokenException:
OpenLRW.pretty_error("Error", "JWT Expired")
```
> A Python Client making your scripts for OpenLRW easier
<p align="center">
<a href='https://www.python.org/dev/peps/pep-0008/'><img src="https://img.shields.io/badge/code%20style-pep8-orange.svg" alt="code style pep 8"></a>
<a href="https://badge.fury.io/py/openlrw"><img src="https://badge.fury.io/py/openlrw.svg" alt="PyPI version"></a>
</p>
## Getting Started
` pip install openlrw `
## Usage
#### 1. Interacting with the User collection
```python
from openlrw.client import OpenLRW
from openlrw.exceptions import ExpiredTokenException
OpenLrw = OpenLRW(uri, username, password) # Create an instance of the client
jwt = OpenLrw.generate_jwt() # Generate a JSON Web Token for using OneRoster routes
# 1. Get the user john_doe
try:
user = OpenLrw.get_user('john_doe', jwt)
except ExpiredTokenException:
OpenLRW.pretty_error("Error", "JWT Expired")
# 2. Get all the users
try:
users = OpenLrw.get_users(jwt)
except ExpiredTokenException:
OpenLRW.pretty_error("Error", "JWT Expired")
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openlrw-1.0.0rc0.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for openlrw-1.0.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe37173b729cd4172e528a70d7ca811c86b7b244a7c20674e3433776c33717cc |
|
MD5 | 27f06e74ee5a729f8567f66a0a0532ec |
|
BLAKE2b-256 | ee048825fc87d33b6cf9616f3e7abb811b8764ff129a77fad0780f81b4db17aa |