The official QFieldCloud SDK and CLI.
Project description
The official QFieldCloud SDK and CLI
qfieldcloud-sdk
is the official client to connect to QFieldCloud API either as a python module, or directly from the command line.
Install
pip install qfieldcloud-sdk
Module usage
import requests
from qfieldcloud_sdk import sdk
client = sdk.Client(
url="https://app.qfield.cloud/api/v1/",
username="user1",
password="pass1",
)
try:
projects = client.list_projects()
except requests.exceptions.RequestException:
print("Oops!")
CLI usage
The official QFieldCloud CLI tool.
Usage
qfieldcloud-cli [OPTIONS] COMMAND [ARGS]...
Examples
# logs in user "user" with password "pass"
qfieldcloud-cli login user pass
# gets the projects of user "user" with password "pass" at "https://localhost/api/v1/"
qfieldcloud-cli -u user -p pass -U https://localhost/api/v1/ list-projects
# gets the projects of user authenticated with token `QFIELDCLOUD_TOKEN` at "https://localhost/api/v1/" as JSON
export QFIELDCLOUD_URL=https://localhost/api/v1/
export QFIELDCLOUD_TOKEN=017478ee2464440cb8d3e98080df5e5a
qfieldcloud-cli --json list-projects
More detailed documentation can be found here
Development
Contributions are more than welcome!
Code style
Code style done with precommit.
pip install pre-commit
# install pre-commit hook
pre-commit install
Cloning the project
One time action to clone and setup:
git clone https://github.com/opengisch/qfieldcloud-sdk-python
cd qfieldcloud-sdk-python
# install dev dependencies
python3 -m pip install pipenv
pipenv install --dev
pre-commit install
To run CLI interface for development purposes execute:
pipenv run python src/bin/qfieldcloud-cli
To ease the development, you can set a .env
file. Therefore you can use directly the qfieldcloud-cli
executable:
cp .env.example .env
pipenv run qfieldcloud-cli
Building the package
Run:
python3 -m build
Then install on your system:
python3 -m pip install dist/qfieldcloud_sdk-dev-py3-none-any.whl --force-reinstall
Voila!
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 Distribution
qfieldcloud-sdk-0.6.1.tar.gz
(12.4 kB
view hashes)
Built Distribution
Close
Hashes for qfieldcloud_sdk-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e2350e6cae245d4ec0066f533b417d3ef12bce6aa7e087bdbdaad49df4d94e |
|
MD5 | e872e2668bb029c1b82b4bea8f840632 |
|
BLAKE2b-256 | 8d83b4d9d4cf1a80a4045fe340f01aded955657e1f24e7f010de7e06b6f0449e |