https://github.com/sectasy0/python-rest
Python flask rest api with token authorization
https://github.com/sectasy0/python-rest
Last synced: 10 months ago
JSON representation
Python flask rest api with token authorization
- Host: GitHub
- URL: https://github.com/sectasy0/python-rest
- Owner: sectasy0
- Created: 2020-06-05T12:34:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T08:27:58.000Z (over 5 years ago)
- Last Synced: 2025-01-06T11:44:38.118Z (over 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask Mongo RESTapi Example - with jwt-authentication
### Installation
```sh
$ virtualenv auth
$ cd auth && source bin/active
$ git clone https://github.com/sectasy0/Python-REST
$ pip install -r src/REQUIREMENTS.txt
```
### Configure database
```
Open __init__.py and change 'host' value to your mongo database and db to your database name.
```
### Requests to api
#### Register user
```sh
$ http POST :5000/api/v1.0/auth/register username=testuser password=testuserpassword email=test@email.com
```
#### Login user
```sh
$ http POST :5000/api/v1.0/auth/login username=testuser password=testuserpassword
```
#### Get all users
```sh
$ http GET :5000/api/v1.0/users Autorization:"Bearer "
```
#### Get one user
```sh
$ http GET :5000/api/v1.0/users/ Autorization:"Bearer "
```
#### Update user
```sh
$ http PUT :5000/api/v1.0/users/ Autorization:"Bearer " username=newusername ...
```
#### delete user
```sh
$ http DELETE :5000/api/v1.0/users/ Autorization:"Bearer "
```
#### Refresh access-token
```sh
$ http PUT :5000/api/v1.0/users/ Autorization:"Bearer "
```