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)
Metadata
Release files for speedy-bg 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| speedy_bg-1.0.0.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| speedy_bg-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / speedy_bg-1.0.0.tar.gz
| Download URL | speedy_bg-1.0.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
812846f2ca59efe9c8f1a4d3229c85f5ff5c0acda21ef3ec85c096f52ec425dc
|
|
BLAKE2b-256 checksum How to use checksums |
e112dc526b50f8419749d4fdf865223bb19653b361cc569ef2fe02bf0b2d2a6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / speedy_bg-1.0.0-py3-none-any.whl
| Download URL | speedy_bg-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2875ffe6dc960d4c8ac8373a390d9f1ff4c50f599bba35d696b5cb34aa4e055
|
|
BLAKE2b-256 checksum How to use checksums |
dffd1fe569630346ce9eb2720f29255167f5f9187b0c9b92a5ca406bcff1559f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|