Skip to content

A Python client for interacting with the Ploomes API. This client is designed to streamline and simplify the process of making requests to the Ploomes API, making it easier to integrate Ploomes functionality into Python applications.

License

Notifications You must be signed in to change notification settings

filterfeed/ploomes-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. 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.
  2. 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.

  3. Verify the upload:

    • Check the PyPI project page to ensure your new version is listed.

About

A Python client for interacting with the Ploomes API. This client is designed to streamline and simplify the process of making requests to the Ploomes API, making it easier to integrate Ploomes functionality into Python applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages