Skip to main content

📦📦 pplmyapi (Python PPL myAPI wrapper)

Czech PPL (Professional Parcel Logistic) API wrapper written in Python. Helps you to communicate with PPL myAPI without worring about fetching access tokens and constructing your own requests. All (hopefully) done for you in the background.

Install it from PyPI

pip install pplmyapi

Usage

This is still a work in progress, so the API might change in the future. However, the basic usage is as follows:

  1. Create a PPL instance with your credentials
  2. obtain a RESTConnector instance from the PPL instance.
  3. use the RESTConnector instance to communicate with the PPL REST API (myAPI2)

Send a package

# Create Package instance with all the required data and 6 packages in the set
package = Package(
    reference_id="123456789",
    package_product_type=Product.PPL_PARCEL_CZ_PRIVATE_COD,
    note = "test",
    recipient=Recipient(
        name="John Doe",
        city="Hradec Králové",
        street="Hlavní 1",
        zip_code="50001",
        phone="123456789",
        email="j.doe@example.com",
        country = 'CZ'
    ),
    sender=Sender(
        name="Test s.r.o.",
        street="Testovací 55/36",
        city="Praha",
        zip_code="11000",
        country="CZ",
    ),
    payment_info=PaymentInfo(
        cod_price=100,
        cod_currency='CZK',
        cod_vs='123456789',
        insurance_price=100,
        insurance_currency='CZK',
        specific_symbol='123456',
        bank_account='123456789',
        bank_code='0300'
    ),
    weighted_package_info=WeightedPackageInfo(
        weight=10.22,
    ),
    package_set=(
        PackageSet(
            total_packages = 6,
        )
    ),
    flags=[
        PackageFlag(
            code=Flag.CL,
            value=True
        )
    ],
)
# create packages
packages = [package]

# create rest_connector
rest_con = ppl.connector()

# create rest_action
response = rest_con.post_shipments(
    packages=packages,
    file_path = './out_test',
    file_name = 'test_010223.pdf',
)

Response from the API is a dictionary containing the following keys:

  • labels: base64 encoded labels from the API (all together)
  • packages: list of Package instances (initionaly passed to the post_shipments function) with extended shipment_number attribute, label_base64 attribute (with single label) and extended package_set attribute (with related_packages attribute containing list of Package instances related to the current package with the same reference_id attribute but different shipment_number attribute)

Get label for a package

# TODO

Development

If you're keen on contributing to this project, you can do so by forking this repository and creating a pull request. Please make sure to follow the PEP8 style guide.

Metadata

Release files for pplmyapi 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pplmyapi 0.0.7
File Size Uploaded
pplmyapi-0.0.7.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pplmyapi 0.0.7
File Interpreter ABI Platform
pplmyapi-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 54.1 kB

Release files / pplmyapi-0.0.7.tar.gz

Download URL pplmyapi-0.0.7.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a68dc22c0b8af6e3b148b78124b91ea1c6e13a46050c6314287d4ddd5381dbc5
BLAKE2b-256 checksum
How to use checksums
b8688df50eef6ef35927969e4fa4190ae2e0085b354f46a9982bb1de8c2b6cc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.10

Release files / pplmyapi-0.0.7-py3-none-any.whl

Download URL pplmyapi-0.0.7-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54d9cfa5834a85bf8ec67031f724ea4170d64ac76685d6dd87bc84f8159cbf5b
BLAKE2b-256 checksum
How to use checksums
3a2951fba991c0fe1eefbc70f0e973b62df111ff1c2b9fd3db1ccbfe472833bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page