Provides access to the pakkelabels.dk web service.
Project description
# Pykkelabels
Python implementation of the Pakkelabels.dk php package for interacting with the Pakkelabels.dk web service. For documentation on usage and the methods, see the documentation [here](https://www.pakkelabels.dk/integration/api/).
## Installation
Easiest way is to install the package using pip: ` pip install Pykkelabels `
Alternatively, download the repository from github and put the Pykkelabels folder into your project folder.
## Usage
Import the package and accompanying exceptions using: ` from pykkelabels import Pykkelabels, URLError, HTTPError `
The first thing required is to login: ` label = new Pykkelabels('api_user', 'api_key') `
This will login and fetch the required token. The token is then automatically added to any subsequent calls.
To see the generated token you can use: ` print(label.getToken()) `
### Examples: Get all Post Danmark labels shipped to Denmark: ` labels = label.shipments({'shipping_agent': 'pdk', 'receiver_country': 'DK'}) `
Get the PDF for a specific label: ` import base64 base64 = label.pdf(31629) pdf = base64.b64decode(base64) `
### Exceptions: If there is problems with the connectivity to the server, or if the returned data is not parsable, a URLError is raised. If the server returns an error a HTTPError exception is raised, with a message containing the error message from the server.
## Contributing
See the github guide to contributing [here](https://guides.github.com/activities/contributing-to-open-source/).
## History
v0.1: First working release. Most of the functionality is still untested.
v0.1.1: Added unittests to the methods where it is possible
v0.1.2: Prepared pypi release
v0.1.3: Added better error handling, and added custom exception. Added testing for bad inputs. Implemented better test of pdf generation.
v0.1.4: Removed inwanted files from pypi release
## Credits
Anders Winther Brandt
## License
MIT, see LICENSE file
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
Built Distributions
Hashes for Pykkelabels-0.1.4.win32-py3.5.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa9a3e9ad2b3f72a42e832851561083a66916a32da650650639eb63ca1e59e69 |
|
MD5 | 82e335a9b584505704f160bf9b33e918 |
|
BLAKE2b-256 | 2c7b4e6a0bbe383f23388a485a9f1bbc4ba02a6ae721057ff89835633f1b16fc |
Hashes for Pykkelabels-0.1.4.win32-py3.4.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0acb6b66f378856602b202760e9c9ac298f87afd61bc1505e4d67443395c8b3 |
|
MD5 | de9cbd2a10019db64543727393eed7f5 |
|
BLAKE2b-256 | 9c31972df793701b089110523b362556004579ddb3523d3e851c0a5c3d69545b |