https://github.com/fastn-stack/fastn_py
Python package to facilitate working with https://fastn.com/
https://github.com/fastn-stack/fastn_py
Last synced: about 2 months ago
JSON representation
Python package to facilitate working with https://fastn.com/
- Host: GitHub
- URL: https://github.com/fastn-stack/fastn_py
- Owner: fastn-stack
- License: bsd-3-clause
- Created: 2023-11-23T09:15:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-17T11:18:50.000Z (over 1 year ago)
- Last Synced: 2024-01-17T18:44:28.298Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastn_py
Python package to facilitate working with [fastn](https://fastn.com/)
## Requirements
- **Python** 3.6 and above
- **Django** 4.0 and above## Installation
```
pip install fastn
```## GithubAuthMiddleware
- Add `'fastn.django.GithubAuthMiddleware'` to `MIDDLEWARE` after
`django.contrib.auth.middleware.AuthenticationMiddleware`.- By default, this middleware will create a [django
User](https://docs.djangoproject.com/en/5.0/ref/contrib/auth/#user-model)
from fastn session and call
[`login()`](https://docs.djangoproject.com/en/5.0/topics/auth/default/#django.contrib.auth.login)
on this user. To change this behaviour, add the following to your
`settings.py` file:```python
FASTN_AUTH_CALLBACK = "some.module.auth_callback"
```the `some.module.auth_callback` will be called with
[`request`](https://docs.djangoproject.com/en/5.0/ref/request-response/#httprequest-objects)
and `fastn_user`. `fastn_user` is a dict:```python
fastn_user = {
"username": "john",
"name": "John Do",
"email": "[email protected]",
}
```