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.0.tar.gz
(37.0 kB
view details)
Built Distribution
File details
Details for the file sftpgo-client-0.3.0.tar.gz
.
File metadata
- Download URL: sftpgo-client-0.3.0.tar.gz
- Upload date:
- Size: 37.0 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.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250985c9a1abdd26e046888b4432bf7e890402999d0064b3f5ea613708d0da3a |
|
MD5 | d28a952b8e586b074b1153951dc7964e |
|
BLAKE2b-256 | 3e4e1a0dfd064ebb7e9e4e43d4348c86c7ec9eda38307fd67034e6eb8f226f86 |
File details
Details for the file sftpgo_client-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: sftpgo_client-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 119.4 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.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0748dd9b4fe36f58f8df836fd566ce19107d2697d834ec3107d2e5f96cf8224d |
|
MD5 | 6d0d8c3424e2827c97b6ba8917d7f8f0 |
|
BLAKE2b-256 | d060f57da37386c3e09c9ba0925ef26e655a3b36347ebcf3a5f94267e2a53c15 |