Appearance
Python and Rust clients
The Python and Rust clients are generated from the OpenAPI specs in specs/ with ./scripts/gen.sh. Method names come from operationId, so they match across languages.
The OpenLogistics provider-agnostic entry point is TypeScript-only for now. Python and Rust keep one module per provider; see the OpenLogistics client for the TypeScript surface.
Install
bash
pip install open-logistics-sdkbash
cargo add open-logisticsPython
python
from open_logistics.shiprocket import ApiClient, AuthApi, AuthCredentials, Configuration, OrdersApi
configuration = Configuration(host="https://apiv2.shiprocket.in/v1/external")
with ApiClient(configuration) as api_client:
auth = AuthApi(api_client).auth_login(AuthCredentials(email=..., password=...))
configuration.access_token = auth.token
order = OrdersApi(api_client).orders_create(payload)Delhivery uses api_key={"delhiveryToken": token} plus api_key_prefix={"delhiveryToken": "Token"}.
Rust
rust
let mut configuration = open_logistics::shiprocket::apis::configuration::Configuration::new();
let auth = open_logistics::shiprocket::apis::auth_api::auth_login(
&configuration,
AuthCredentials { email, password },
).await?;
configuration.bearer_access_token = Some(auth.token);
let order = open_logistics::shiprocket::apis::orders_api::orders_create(
&configuration,
payload,
).await?;Delhivery sets configuration.api_key = Some(ApiKey { prefix: Some("Token".into()), key: token }).
Method names
| TypeScript | Python | Rust |
|---|---|---|
client.orders.create(...) | OrdersApi.orders_create(...) | orders_api::orders_create(...) |
client.orders.list(...) | OrdersApi.orders_list(...) | orders_api::orders_list(...) |
client.tracking.byAWB(...) | TrackingApi.tracking_by_awb(...) | tracking_api::tracking_by_awb(...) |
Differences from the TypeScript SDK
- Delhivery responses are returned raw. Tracking exposes
ShipmentData;rates_calculatereturns the provider's charge estimates; packing slips exposepdf_urlandpackages_found. - Credentials are not injected into query parameters for Delhivery waybill helpers. Pass
cl,client_name, andtokenexplicitly when your account requires them. - OpenAPI cannot describe two operations on the same path and method, so some TypeScript convenience aliases collapse. For example, Delhivery
createOrder,updateOrder, andcancelOrdermap toorders_createandorders_edit.
The generated sources live in packages/python/open-logistics and packages/rust/open-logistics; do not edit them by hand. Change the specs and regenerate with ./scripts/gen.sh.
FAQ
Which languages are supported?
TypeScript (npm package open-logistics), Python (PyPI distribution open-logistics-sdk, import open_logistics), and Rust (crate open-logistics).
Are the Python and Rust clients generated from the same API?
Yes. Both are generated from the OpenAPI specs in specs/ with ./scripts/gen.sh, using operationId values for method names.
Do the Python and Rust clients return the same responses as TypeScript?
No. They use the same operation names, but return raw provider payloads, while the TypeScript SDK returns normalized responses for some resources. See normalization.
Do I need to install the TypeScript SDK to use Python or Rust?
No. Each language has its own package and calls the Shiprocket and Delhivery APIs directly.