Skip to main content

Speedy Express Service

Project description

speedy

📦 A simple Python wrapper for the Speedy.bg REST API

# Example usage of SpeedyAPI
from speedy_bg.api import SpeedyAPI


if __name__ == "__main__":
    api = SpeedyAPI("your_username", "your_password")

    # 1) Find a country
    country = api.find_country(name="BULGARIA")
    print("Country:", country)

    # 2) Get contract clients (useful to know your clientId)
    clients = api.get_contract_clients()
    print("Clients:", clients)

    # 3) Find site by post code
    site = api.find_site(country_id=100, post_code="1000")  # 100 = Bulgaria ID
    print("Site by postcode:", site)

    # 4) Find office in Sofia
    office = api.find_office(name="SOFIA")
    print("Offices:", office)

    # 5) Create shipment
    sender = {
        "clientId": 123456,  # from get_contract_clients
        "contactName": "Sender Name",
        "phone1": "0888123456"
    }
    recipient = {
        "privatePerson": True,
        "contactName": "John Doe",
        "phone1": "0899123456",
        "addressLocation": {
            "countryId": 100,
            "siteId": 68134  # e.g. Sofia
        }
    }
    service = {"serviceId": 505}   # example: delivery service ID
    content = {"parcelsCount": 1, "totalWeight": 2.5}
    payment = {"courierServicePayer": "SENDER"}

    shipment = api.create_shipment(sender, recipient, service, content, payment)
    print("Created shipment:", shipment)

    # 6) Print waybill as PDF
    if "parcels" in shipment:
        parcel_ids = [p["id"] for p in shipment["parcels"]]
        pdf_data = api.print_waybill(parcel_ids)
        with open("waybill.pdf", "wb") as f:
            f.write(pdf_data)
        print("Waybill saved as waybill.pdf")

    # 7) Calculate price for a destination
    calc = api.calculate(sender={"clientId": 123456},
                         recipient={"privatePerson": True, "addressLocation": {"countryId": 100, "siteId": 68134}})
    print("Calculation:", calc)

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

speedy_bg-1.0.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

speedy_bg-1.0.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file speedy_bg-1.0.0.tar.gz.

File metadata

  • Download URL: speedy_bg-1.0.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for speedy_bg-1.0.0.tar.gz
Algorithm Hash digest
SHA256 812846f2ca59efe9c8f1a4d3229c85f5ff5c0acda21ef3ec85c096f52ec425dc
MD5 efb783d734a1fc0510017a4c8f88fa7e
BLAKE2b-256 e112dc526b50f8419749d4fdf865223bb19653b361cc569ef2fe02bf0b2d2a6d

See more details on using hashes here.

File details

Details for the file speedy_bg-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: speedy_bg-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for speedy_bg-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2875ffe6dc960d4c8ac8373a390d9f1ff4c50f599bba35d696b5cb34aa4e055
MD5 f7d6714d72cc50bac2c55571d3503e6e
BLAKE2b-256 dffd1fe569630346ce9eb2720f29255167f5f9187b0c9b92a5ca406bcff1559f

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