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.14.0.tar.gz (31.6 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.14.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qfieldcloud_sdk-0.14.0.tar.gz
  • Upload date:
  • Size: 31.6 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.14.0.tar.gz
Algorithm Hash digest
SHA256 bc28168534af1ff3b8c390a94a800cbf74f6ddfa43055afc642bc3ba16a0562c
MD5 6f9f88604a7ea32df5c057b54523d1e4
BLAKE2b-256 0139534790e0e5fee919211877f9d067b4a9983ac605467a9c3afb492993b90b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qfieldcloud_sdk-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66256eed8e2f390f6f5906c82984b3732f365e2f3413d3d4c69584895b170b52
MD5 42e758ba48824317ff5cf519e83578ea
BLAKE2b-256 7d6b254e12a8c71987d9ac9fb2ac353274e17aa46c049a3a97058a9cda0ceb3d

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