ISPyB backend server
Project description
py-ispyb
ISPyB backend server based on python flask-restx.
Dependencies
- Python 3.5+ / pypy2
- flask-restx (+ flask)
- sqlalchemy (+ flask-sqlalchemy) - Database ORM.
- marshmallow
- ruamel.yaml
How to run py-ispyb
Install requirements
In case of MySQL or MariaDB you might have to install dev tools:
sudo apt-get install -y python3-mysqldb
or
apt-get install libmariadbclient-dev
Install python dependencies:
sudo pip install -r requirements.txt
Copy and edit yaml configuration file
cp ispyb_core_config_example.yml ispyb_core_config.yml
If you do not have a running ispyb database then you can create one by running:
scripts/create_core_db.sh
Regenerate data base models and schemas
cd scripts
./generate_core_models.sh PATH_TO_CONFIG_FILE.yml
python3 generate_core_schemas.py
cd ..
Run application in debug mode
python3 wsgi.py
invoke app.run
Now you can go to http://localhost:5000/ispyb/api/v1/doc and explore py-ispyb via swagger ui. For authentication json web tokens (jwt) are used. In the web browser call http://localhost:5000/ispyb/api/v1/auth/login , enter user credentials and retrieve access token from the response:
{
"token": "YOUR_JWT_TOKEN",
"roles": [
"user"
]
}
Corresponding curl command:
curl -u USER:PASS -i -H "Accept:application/json" http://localhost:5000/ispyb/api/v1/auth/login
In the case of dummy authentication username user will grant user role and manager will grant user and manager roles.
For requests use the token in the Authorization
header: Bearer YOUR_JWT_TOKEN
. For example to retrieve proposals call:
curl -X GET -H 'Authorization: Bearer YOUR_JWT_TOKEN' -i http://localhost:5000/ispyb/api/v1/proposals
Misc
- Swagger documentation: https://raw.githubusercontent.com/ispyb/py-ispyb/master/docs/swagger.json
- For deployment options see
deploy
directory. - Status codes: https://www.flaskapi.org/api-guide/status-codes/
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 Distributions
Built Distribution
File details
Details for the file pyispyb-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyispyb-1.0.0-py3-none-any.whl
- Upload date:
- Size: 172.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96be1bc2358e3491574941359aefaaa921ad201f8ec3254290a19f2c2bcaff7a |
|
MD5 | 6400f287d833a06c660c7abc1037fa09 |
|
BLAKE2b-256 | d03f56f2486e86bd624bd946db0258741514074b355922d2abbaaa3e9dde02a4 |