pplmyapi


Namepplmyapi JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/michalpulpan/pplmyapi
SummaryPython client for PPL myAPI
upload_time2023-07-12 11:32:12
maintainer
docs_urlNone
authorMichal Půlpán
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements backports.cached-property binapy certifi cffi charset-normalizer cryptography furl idna jwskate lxml oauthlib orderedmultidict pycparser python-dotenv requests six typing-extensions urllib3 xmltodict
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📦📦 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
```bash
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
```python
# 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
```python
# 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](https://www.python.org/dev/peps/pep-0008/) style guide.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/michalpulpan/pplmyapi",
    "name": "pplmyapi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Michal P\u016flp\u00e1n",
    "author_email": "michal@michalpulpan.cz",
    "download_url": "https://files.pythonhosted.org/packages/b8/68/8df50eef6ef35927969e4fa4190ae2e0085b354f46a9982bb1de8c2b6cc5/pplmyapi-0.0.7.tar.gz",
    "platform": null,
    "description": "# \ud83d\udce6\ud83d\udce6 pplmyapi (Python PPL myAPI wrapper) \nCzech 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.\n\n# Install it from PyPI\n```bash\npip install pplmyapi\n```\n\n## Usage\nThis is still a work in progress, so the API might change in the future. However, the basic usage is as follows:\n1. Create a `PPL` instance with your credentials\n2. obtain a `RESTConnector` instance from the `PPL` instance.\n3. use the `RESTConnector` instance to communicate with the PPL REST API (myAPI2)\n\n### Send a package\n```python\n# Create Package instance with all the required data and 6 packages in the set\npackage = Package(\n    reference_id=\"123456789\",\n    package_product_type=Product.PPL_PARCEL_CZ_PRIVATE_COD,\n    note = \"test\",\n    recipient=Recipient(\n        name=\"John Doe\",\n        city=\"Hradec Kr\u00e1lov\u00e9\",\n        street=\"Hlavn\u00ed 1\",\n        zip_code=\"50001\",\n        phone=\"123456789\",\n        email=\"j.doe@example.com\",\n        country = 'CZ'\n    ),\n    sender=Sender(\n        name=\"Test s.r.o.\",\n        street=\"Testovac\u00ed 55/36\",\n        city=\"Praha\",\n        zip_code=\"11000\",\n        country=\"CZ\",\n    ),\n    payment_info=PaymentInfo(\n        cod_price=100,\n        cod_currency='CZK',\n        cod_vs='123456789',\n        insurance_price=100,\n        insurance_currency='CZK',\n        specific_symbol='123456',\n        bank_account='123456789',\n        bank_code='0300'\n    ),\n    weighted_package_info=WeightedPackageInfo(\n        weight=10.22,\n    ),\n    package_set=(\n        PackageSet(\n            total_packages = 6,\n        )\n    ),\n    flags=[\n        PackageFlag(\n            code=Flag.CL,\n            value=True\n        )\n    ],\n)\n# create packages\npackages = [package]\n\n#\u00a0create rest_connector\nrest_con = ppl.connector()\n\n#\u00a0create rest_action\nresponse = rest_con.post_shipments(\n    packages=packages,\n    file_path = './out_test',\n    file_name = 'test_010223.pdf',\n)\n```\nResponse from the API is a dictionary containing the following keys:\n- `labels`: base64 encoded labels from the API (all together)\n- `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)  \n\n### Get label for a package\n```python\n# TODO\n```\n\n\n## Development\nIf 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](https://www.python.org/dev/peps/pep-0008/) style guide.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for PPL myAPI",
    "version": "0.0.7",
    "project_urls": {
        "Homepage": "https://github.com/michalpulpan/pplmyapi"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a2951fba991c0fe1eefbc70f0e973b62df111ff1c2b9fd3db1ccbfe472833bb",
                "md5": "570b1776c54baecdbcf9dc0fa2cd9309",
                "sha256": "54d9cfa5834a85bf8ec67031f724ea4170d64ac76685d6dd87bc84f8159cbf5b"
            },
            "downloads": -1,
            "filename": "pplmyapi-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "570b1776c54baecdbcf9dc0fa2cd9309",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 31190,
            "upload_time": "2023-07-12T11:32:10",
            "upload_time_iso_8601": "2023-07-12T11:32:10.869280Z",
            "url": "https://files.pythonhosted.org/packages/3a/29/51fba991c0fe1eefbc70f0e973b62df111ff1c2b9fd3db1ccbfe472833bb/pplmyapi-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8688df50eef6ef35927969e4fa4190ae2e0085b354f46a9982bb1de8c2b6cc5",
                "md5": "deefe7d0daf4f39add912b012357faaa",
                "sha256": "a68dc22c0b8af6e3b148b78124b91ea1c6e13a46050c6314287d4ddd5381dbc5"
            },
            "downloads": -1,
            "filename": "pplmyapi-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "deefe7d0daf4f39add912b012357faaa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 22954,
            "upload_time": "2023-07-12T11:32:12",
            "upload_time_iso_8601": "2023-07-12T11:32:12.855752Z",
            "url": "https://files.pythonhosted.org/packages/b8/68/8df50eef6ef35927969e4fa4190ae2e0085b354f46a9982bb1de8c2b6cc5/pplmyapi-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-12 11:32:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "michalpulpan",
    "github_project": "pplmyapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "backports.cached-property",
            "specs": [
                [
                    "==",
                    "1.0.2"
                ]
            ]
        },
        {
            "name": "binapy",
            "specs": [
                [
                    "==",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2022.12.7"
                ]
            ]
        },
        {
            "name": "cffi",
            "specs": [
                [
                    "==",
                    "1.15.1"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "2.1.1"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    "==",
                    "39.0.0"
                ]
            ]
        },
        {
            "name": "furl",
            "specs": [
                [
                    "==",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.4"
                ]
            ]
        },
        {
            "name": "jwskate",
            "specs": [
                [
                    "==",
                    "0.3.0"
                ]
            ]
        },
        {
            "name": "lxml",
            "specs": [
                [
                    "==",
                    "4.9.2"
                ]
            ]
        },
        {
            "name": "oauthlib",
            "specs": [
                [
                    "==",
                    "3.2.2"
                ]
            ]
        },
        {
            "name": "orderedmultidict",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "pycparser",
            "specs": [
                [
                    "==",
                    "2.21"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    "==",
                    "0.21.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.4.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "1.26.13"
                ]
            ]
        },
        {
            "name": "xmltodict",
            "specs": [
                [
                    "==",
                    "0.13.0"
                ]
            ]
        }
    ],
    "lcname": "pplmyapi"
}
        
Elapsed time: 0.14242s