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.2.3.tar.gz
(30.5 kB
view details)
Built Distribution
File details
Details for the file sftpgo-client-0.2.3.tar.gz
.
File metadata
- Download URL: sftpgo-client-0.2.3.tar.gz
- Upload date:
- Size: 30.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd37a0d59d12112bf04e4f0b5a025f638fc2a5e6246ea62a32812a8aed1d5b11 |
|
MD5 | 990a825680aff97a33dd4ec56df236f7 |
|
BLAKE2b-256 | 20ca4dff84523f48764daeb2605b94a4ed48058e61a57d190b42ef6cbf9a14d8 |
File details
Details for the file sftpgo_client-0.2.3-py2.py3-none-any.whl
.
File metadata
- Download URL: sftpgo_client-0.2.3-py2.py3-none-any.whl
- Upload date:
- Size: 88.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1493c44137d8a1636e267f4f26932dc932314cafc5aefd505bb7b3cdfc3a4dd8 |
|
MD5 | 27ee08175e6c0c0300e2ceecd2840cc9 |
|
BLAKE2b-256 | ec823061e59dac1a59f4d24dd153756ba37ad486eae8f2db8ddf26b40ed41284 |