Skip to main content

Official Python Pingen SDK for API V2

Project description

Requirements

You need to have an account in pingen and obtain oauth credentials for your desired grant type (usually client_credentials).

How to obtain these are described here: https://api.pingen.com/documentation#section/Authentication/How-to-obtain-a-Client-ID

Python 3.10+

Installation

You don't need this source code unless you want to modify the package. If you just want to use the package, just run:

pip install --upgrade pingen2sdk

Environments

We have two Environments available: Production and Staging (see https://api.pingen.com/documentation#section/Basics/Environments)

This SDK supports staging as well. When initiating the resource (see Usage), the optional 'staging' attribute should be set, as well as when creating an endpoint object.

Usage

The simplest way to integrate is using the client credentials grant (see https://api.pingen.com/documentation#section/Authentication/Which-grant-type-should-i-use)

import pingen2sdk

pingen2sdk.client_id = "YOUR_CLIENT_ID"
pingen2sdk.client_secret = "YOU_SECRET"

resp = pingen2sdk.OAuth.get_token(
    use_staging=True,
    grant_type="client_credentials",
    scope="letter batch webhook organisation_read",
)

access_token = resp["access_token"]

organisationList = pingen2sdk.Organisations(access_token, True).get_collection()

organisation_id = organisationList.data["data"][0]["id"]

LettersEndpoint = pingen2sdk.Letters(organisation_id, access_token, True)

response = LettersEndpoint.upload_and_create(
    "./letter.pdf",
    "sdk.pdf",
    "left",
    False,
    "fast",
    "simplex",
    "color",
)

letter_id = response.data["data"]["id"]

Examples & Docs

Our API Docs are here: https://api.pingen.com/documentation

On the right-hand side of every endpoint you can see request samples for Python and other languages, which you can copy and paste into your application.

Bugreport & Contribution

If you find a bug, please either create a ticket in github, or initiate a pull request.

Versioning

We adhere to semantic (major.minor.patch) versioning (https://semver.org/). This means that:

  • Patch (x.x.patch) versions fix bugs
  • Minor (x.minor.x) versions introduce new, backwards compatible features or improve existing code.
  • Major (major.x.x) versions introduce radical changes which are not backwards compatible.

In your automation or procedure you can always safely update patch & minor versions without the risk of your application failing.

Testing

Run all tests for a specific Python version (modify -e according to your Python target):

tox -e py312

Run the linter with:

tox -e lint

The library uses Black for code formatting. Code must be formatted with Black before PRs are submitted, otherwise CI will fail. Run the formatter with:

tox -e fmt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pingen2sdk-2.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pingen2sdk-2.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pingen2sdk-2.1.0.tar.gz.

File metadata

  • Download URL: pingen2sdk-2.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pingen2sdk-2.1.0.tar.gz
Algorithm Hash digest
SHA256 e3c65c5499d18050203fb5e7be9ded133bd7c062c42b555e39f879f817115f0e
MD5 1382f5db9e2125ddd287410d9bd9d835
BLAKE2b-256 195c3411d1741314395cb37787097ab398950bc03a71b3c8016f86747a20dbcb

See more details on using hashes here.

File details

Details for the file pingen2sdk-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: pingen2sdk-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pingen2sdk-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 275328c2050303ef3f23cdea6e765137503a653c4dd7ed7b72bd0b64778078b7
MD5 c3ed44e6ddb970c60bc4f5c89d96c9c5
BLAKE2b-256 4fd82896ee089452cad047e3cedb541f7ff4ae50776fb8189c825235c1d821f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page