Skip to main content

ISPyB backend server

Project description

py-ispyb

Codacy Badge Build Status codecov License: LGPL v3

ISPyB backend server based on python flask-restx.

Dependencies

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyispyb-1.0.0-py3-none-any.whl (172.8 kB view details)

Uploaded Python 3

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

Hashes for pyispyb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96be1bc2358e3491574941359aefaaa921ad201f8ec3254290a19f2c2bcaff7a
MD5 6400f287d833a06c660c7abc1037fa09
BLAKE2b-256 d03f56f2486e86bd624bd946db0258741514074b355922d2abbaaa3e9dde02a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page