Skip to main content

pydpd

A DPD API wrapper (UK only)

Create DPD shipments and generate parcel labels from within your application or webapp.

You will need a valid DPD account and have API access enabled (which can be done by calling 0121 275 7336)

Features

  • Check available services for a shipment
  • Create a shipment
  • Generate labels in HTML, PDF, PNG or the raw printer data

What's not possible

  • Collections
  • Swaps
  • Extended Liability
  • Internation Shipments

Installation

Download and install can be done through PyPi

pip install pydpd

or

git clone https://github.com/lewis-morris/pydpd
cd pydpd
pip install -e .

IMPORTANT NOTE

If you want to generate PDF or PNG versions of your labels you will have to install some additional software

Linux / Ubuntu

sudo apt-get install wkhtmltopdf

sudo apt-get install wkhtmltoimage

Windows

Windows installer download

When installing wkhtmltopdf and wkhtmltoimage on windows you need to set an environment variable to point to the wkhtmltopdf or wkhtmltoimage executable. You should be able to find extensive documentation to this online, but I won't provide a link to this to avoid dead links etc.

Pending Features

  • Parcel Tracking

How to use

Minimal working example

from pydpd import DPD, Parcel, Address

#create sender object
sender = Address(**{"name": "Mr Ship",
                    "organisation": "SuperShipCo",
                    "address1": "Ship Street",
                    "address2": "Shipton",
                    "postcode": "BR5 3DX"})
#create dpd object
dpd = DPD("[your dpd username]","[your dpd password]","[your dpd acc no]", sender)

#create a parcel definition
my_parcel = Parcel(**{"weight": 10,
                         "pcs": 2,
                         "name": "Boris",
                         "address1": "10 Downing Street",
                         "address2": "London",
                         "postcode": "SW1A 2AB"})

#book the delivery with "1^12" service - (Next day)  returns a delivery object
my_delivery = dpd.create_delivery(my_parcel,"1^12")

#get dpd PIL image label
my_delivery.get_png_labels(2)[0]

Image

Full Example

I always find it best to learn by example so follow this jupyter notebook to see the flow.

Jupyter notebook examples

All classes have doc strings, so you can always check there if you get stuck.

Contact

If you have any issues or just want to chat you can always email me at lewis.morris@gmail.com or open an issue.

Metadata

Release files for pydpd 0.1.4.12

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

Source distribution (sdist)

Source distribution for pydpd 0.1.4.12
File Size Uploaded Provenance Actions
pydpd-0.1.4.12.tar.gz 8.4 kB Without provenance Details for pydpd-0.1.4.12.tar.gz

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / pydpd-0.1.4.12.tar.gz

Download URL pydpd-0.1.4.12.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
55c5b2a8b7c196f187e15e59ec6d96e0fb1f98ed373d8abab8995c3a0fdefce8
BLAKE2b-256 checksum
How to use checksums
60d7a419e508e1e7a286d67eba9b4da09f65c6e8e24098b20998fce5970a8f69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

Release files / pydpd-0.1.4.12-py3-none-any.whl

Download URL pydpd-0.1.4.12-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c28dc260bbb6535c23a95885ee9863c30281c7b5247d6c6e5a6a775c6487e360
BLAKE2b-256 checksum
How to use checksums
e2735b585c1943f56b6c7fa1f9c49cefa031e04c43c13a3b0b6ddfcb541512a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

Security for pydpd 0.1.4.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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