Skip to main content

Python client for PPL myAPI

Project description

📦📦 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.

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

pplmyapi-0.0.7.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

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

pplmyapi-0.0.7-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file pplmyapi-0.0.7.tar.gz.

File metadata

  • Download URL: pplmyapi-0.0.7.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for pplmyapi-0.0.7.tar.gz
Algorithm Hash digest
SHA256 a68dc22c0b8af6e3b148b78124b91ea1c6e13a46050c6314287d4ddd5381dbc5
MD5 deefe7d0daf4f39add912b012357faaa
BLAKE2b-256 b8688df50eef6ef35927969e4fa4190ae2e0085b354f46a9982bb1de8c2b6cc5

See more details on using hashes here.

File details

Details for the file pplmyapi-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pplmyapi-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for pplmyapi-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 54d9cfa5834a85bf8ec67031f724ea4170d64ac76685d6dd87bc84f8159cbf5b
MD5 570b1776c54baecdbcf9dc0fa2cd9309
BLAKE2b-256 3a2951fba991c0fe1eefbc70f0e973b62df111ff1c2b9fd3db1ccbfe472833bb

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