Python client for the SFTPGo API
Project description
sftpgo-client
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
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
sftpgo-client-0.3.1.tar.gz
(80.5 kB
view details)
Built Distribution
File details
Details for the file sftpgo-client-0.3.1.tar.gz
.
File metadata
- Download URL: sftpgo-client-0.3.1.tar.gz
- Upload date:
- Size: 80.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5208329457aab555311bc070d913ac4e082163b319f93f9856836774f504c2ff |
|
MD5 | 2ebeeb27061ed060c534450bddc884f0 |
|
BLAKE2b-256 | c4e8ac6478af909ae38a54aca5f5152c1a4bd6e7f100d0edbb228c6c60c1a0a8 |
File details
Details for the file sftpgo_client-0.3.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sftpgo_client-0.3.1-py2.py3-none-any.whl
- Upload date:
- Size: 237.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d74194bfd87ec5c246aedf327770b48110d5e4194d1b99fd29b5eab1c70ff3f0 |
|
MD5 | 610e8003b9b5e4fdcf7fc14a84a4814e |
|
BLAKE2b-256 | 83d3f86740708b6df84a375771be6499d5a5f186e4ccff9466e59fbb28cccc18 |