Skip to main content

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 interface (CLI).

Contents

Documentation

QFieldCloud SDK Documentation

Installation

Linux/macOS

pip3 install qfieldcloud-sdk

Windows

Install Python with your favorite package manager. Then:

python -m pip install qfieldcloud-sdk

CLI usage

The package provides 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

Check the examples page in the documentation for more examples.

Module usage

from qfieldcloud_sdk import sdk

client = sdk.Client(url="https://app.qfield.cloud/api/v1/")
client.login(
    username="user1",
    password="pass1",
)

projects = client.list_projects()
> projects
Projects:
0       myusername/myproject1
1       myusername/myproject2
...

Development

Contributions are more than welcome!

Code style

Code style done with precommit.

pip install pre-commit
# if you want to have git commits trigger pre-commit, install pre-commit hook:
pre-commit install
# else run manually before (re)staging your files:
pre-commit run --all-files

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
pre-commit install
# install package in a virtual environment
pipenv install -r requirements.txt

To run CLI interface for development purposes execute:

pipenv shell # if your pipenv virtual environment is not active yet
python -m qfieldcloud_sdk

To ease 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

# make sure your shell is sourced to no virtual environment
deactivate
# build
python3 -m build
# now either activate your shell with
pipenv shell
# and install with
python -m pip install . --force-reinstall
# or manually ensure it's pipenv and not your global pip doing the installation
pipenv run pip install . --force-reinstall

Voilà!

Project details


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.12.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qfieldcloud_sdk-0.12.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file qfieldcloud_sdk-0.12.0.tar.gz.

File metadata

  • Download URL: qfieldcloud_sdk-0.12.0.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qfieldcloud_sdk-0.12.0.tar.gz
Algorithm Hash digest
SHA256 4799ca2ae48e3dd922752cd943a5f1a33a814e7347ea214fdd0e75a578a4348b
MD5 e981d2718cba56c91618d451e61351da
BLAKE2b-256 6dc0ae0b0094a6732421e02528ecebfeef7e74dea67e6139ab45c6293ce068ca

See more details on using hashes here.

File details

Details for the file qfieldcloud_sdk-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qfieldcloud_sdk-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14afa1067069bd15cdce077a4bd09cd3f11ca102dd48ccce0afeec2a2747154e
MD5 4268b11eb8e6a64fd8613c361324319d
BLAKE2b-256 56725be1537694ab7cea375fad225faa480957a87ea38df2b6ccaf8ace65ea8b

See more details on using hashes here.

Supported by

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