Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 authored Jul 1, 2021
1 parent cc4dca8 commit 9edb419
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,55 @@ A Python based parser and RESTful API for ECN's webqueue.
## Docs
See https://pages.github.itap.purdue.edu/ECN/webqueue2-api/

## Usage
### Install via pip:
```
pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@<VERSION>#egg=webqueue2-api
## Installation
```bash
# Create virtual environment named __venv__
python3 -m venv __venv__
# Active virtual environment
source __venv__/bin/activate
# Update pip
pip install -U pip
# Install package
pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@1.0.0#egg=webqueue2api
```
For example, to install version 0.9.1:

## Parser Usage
Load a queue and get the number of items in it.
```python
import webqueue2api
ce_queue = webqueue2api.Queue("ce")
print( len( ce_queue.items ) )
```
pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api
```python
# Expected Output
29
```

### Install via requirements file:
Load an item and get its subject.
```python
import webqueue2api
ce_1 = webqueue2api.Item("ce", 1)
print( len( ce_1.subject ) )
```
git+https://github.itap.purdue.edu/ECN/webqueue2-api@<VERSION>#egg=webqueue2-api
```python
# Expected Output
"Re: Battery Replacement"
```
For example, to install version 0.9.1:

## API Usage
```bash
# Start the API in the background
gunicorn --daemon webqueue2api.api:app
# Login
curl -X POST \
-H "Content-Type: application/json" \
-d '{"username": "bob", "password": "super_secret"}' \
localhost:8000/api/login
```
git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api
```python
# Expected Output
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MjUxMTc4OTAsIm5iZiI6MTYyNTExNzg5MCwianRpIjoiMzZhODYzYmEtNmFhNS00NDc1LTk5NmYtMjhjMTcxZTc4N2M5IiwiZXhwIjoxNjI1MTE4NzkwLCJzdWIiOiJjYW1wYjMwMyIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImNzcmYiOiJkZDA4NmYzMi1lYTEwLTQxNmYtODg3NS1iZTFjZDkwZjkwMTAifQ.SEf_oTxr5vtvMndGtHo9By51LBgAWEQAVcX_N5t0twA"}
```

## Contributing
1. Clone the git repo:
```bash
Expand Down

0 comments on commit 9edb419

Please sign in to comment.