Python client for the Ploomes API
Project description
Ploomes API Python Client
This package provides a simple Python client for interacting with the Ploomes API, designed with rate-limiting and exponential backoff strategies for improved resilience.
Installation
You can install the package from PyPI:
pip install ploomes-api-client
Basic Usage
Contact Management
To manage contacts, first import the necessary classes and initialize them:
from ploomes_client import PloomesClient as Ploomes
from ploomes_client.collections.contacts import Contacts
Initialize PloomesClient and Contacts Class
ploomes = Ploomes(api_key='your_api_key_here')
contacts = Contacts(ploomes)
Creating a New Contact with Expanded Fields
Here is a synthetic example to demonstrate how to create a new contact with expanded Phones
and OtherProperties
:
# Define the payload for the new contact
payload = {
"Name": "Jane Doe",
"Email": "janedoe@example.com",
"Phones": [
{"PhoneNumber": "1234567890", "Type": "Mobile"}
],
"OtherProperties": {"FavoriteColor": "Blue", "Occupation": "Engineer"}
}
# Create the contact
response_json = contacts.post_contact(payload, expand="Phones,OtherProperties")
In this example, the post_contact
method sends a POST request to create a new contact in Ploomes. The payload
dictionary contains the data for the new contact, including fields like Name
, Email
, Phones
, and OtherProperties
. We also use the expand
parameter to expand the Phones
and OtherProperties
fields.
By default, the post_contact
method will return a JSON-formatted string as the response.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Uploading to PyPI with Two-Factor Authentication
-
Generate an API token for your PyPI account:
- Go to the PyPI account settings page and log in.
- Scroll down to the "API Tokens" section and click "Add API Token."
- Provide a description for the token and click "Generate."
- Copy the generated token.
-
Upload your package using the API token:
-
Open your terminal.
-
Navigate to your package directory.
-
Build the distribution files:
python setup.py sdist bdist_wheel
-
Upload the distribution files using the
twine
tool and the generated API token:twine upload --verbose dist/* -u __token__ -p <API_TOKEN>
Replace
<API_TOKEN>
with the copied API token. -
-
Verify the upload:
- Check the PyPI project page to ensure your new version is listed.
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
Built Distribution
File details
Details for the file ploomes-api-client-0.2.142.tar.gz
.
File metadata
- Download URL: ploomes-api-client-0.2.142.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31e80f09c42db8f4d453dfff85bfc890f2d24ecf8f082b9c1d0ce307c96818c |
|
MD5 | 6e20467a162aae5dc7b6ee9fefd7784e |
|
BLAKE2b-256 | d24a05e4ef428458525f8228bebedc9c012d76790af38302b5f8c0f73b306ae2 |
File details
Details for the file ploomes_api_client-0.2.142-py3-none-any.whl
.
File metadata
- Download URL: ploomes_api_client-0.2.142-py3-none-any.whl
- Upload date:
- Size: 28.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f57fe08949cad55fa52d6d6be64bc5dc30653ef62c289887a7b900282eb5763f |
|
MD5 | ef99289a7172d4c77b67835d9a243e0e |
|
BLAKE2b-256 | f947cea0e3a2be6e1f5be5ad176fccdf34a2f1b41cf6fdeb8678c14aa9349c13 |