Skip to main content

Python client for the SFTPGo API

Project description

sftpgo-client

PyPI License Code style

Python client for the SFTPGo API

The sftpgo_client.base package is automatically generated from the OpenAPI specification provided by SFTPGo using openapi-python-client.

Installation

pip install sftpgo-client

Examples

  • Creating a client:
from sftpgo_client import Client

client = Client(
    base_url="http://localhost:8080/api/v2", user="admin", password="password"
)

In an asyncio environment, use the asynchronous client instead:

from sftpgo_client import AsyncClient

client = AsyncClient(
    base_url="http://localhost:8080/api/v2", user="admin", password="password"
)
  • Listing users:
users = client.get_users()
for user in users:
    print(user.username)

or with the asynchronous client:

users = await client.get_users()
for user in users:
    print(user.username)

All API endpoints are available in both the synchronous and asynchronous clients.

  • Adding a new user:
from sftpgo_client import User

user = User.from_dict(
    {
        "username": "user",
        "password": "password",
        "permissions": {"/": ["*"]},
    }
)
client.add_user(json_body=user)

Development

You can fetch the latest version of the SFTPGo OpenAPI specification and update sftpgo_client.base with:

./generator/run.sh

You can run the tests with:

docker-compose up -d
pytest

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

sftpgo-client-0.2.4.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

sftpgo_client-0.2.4-py2.py3-none-any.whl (91.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sftpgo-client-0.2.4.tar.gz.

File metadata

  • Download URL: sftpgo-client-0.2.4.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

File hashes

Hashes for sftpgo-client-0.2.4.tar.gz
Algorithm Hash digest
SHA256 a8c9279caf6c83fe71a33f8c1a56d947b82aaef6e21c79e39977162f2da32d60
MD5 be61c38b1b12a8e974f494b79c145e74
BLAKE2b-256 2c7c38da7a628748fa222e9066c62b48e31f2b44e7d670a69261ef7d612c1181

See more details on using hashes here.

File details

Details for the file sftpgo_client-0.2.4-py2.py3-none-any.whl.

File metadata

  • Download URL: sftpgo_client-0.2.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 91.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

File hashes

Hashes for sftpgo_client-0.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b7fe0eaf1c8aef04071e36e1aea585c68bec227ec3e99980d82305c7f03f0359
MD5 62fad98f464e40c863ec98387a56c968
BLAKE2b-256 ebd7a0c1c24abd9ba1bda96a7592a995468fb9f1384e8191e9f960caa2d2360e

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