Skip to main content

Production-grade Python SDK for SHIP Israel API

Project description

ship-il-sdk

PyPI version Python versions License CI

Independent/community Python SDK for the SHIP Israel API.

This is not an official SHIP SDK. It is an independent/community project.

PyPI: https://pypi.org/project/ship-il-sdk/

Documentation

The OpenAPI file documents the vendor HTTP endpoints, not the Python SDK itself. It is included as a reference for API tooling, contract review, mock servers, or future code generation. The SDK does not load it at runtime.

Installation

From PyPI:

python -m pip install ship-il-sdk

From this repository:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install .

If you only want to run from a checkout without installing:

PYTHONPATH=src python -m pytest -q

Development

Install the SDK and dev tooling inside a virtual environment:

make install

Available commands:

make format
make lint
make typecheck
make test
make check
make integration-test
make package
make release

make package builds the source distribution and wheel into dist/. make release increments the latest vX.Y.Z tag by one patch version, updates pyproject.toml, runs verification, commits the version bump, creates an annotated tag, pushes the branch, and pushes the tag. make check runs lint, typecheck, and tests. make integration-test runs the real API integration script.

CI/CD

GitHub Actions workflows live in .github/workflows/.

  • ci.yml runs on pull requests to main and manual dispatch. It installs the package with dev tooling, then runs lint, typecheck, and tests across Python 3.9 through 3.13, and builds the package once on Python 3.13.
  • release.yml runs only on tags matching v*. It runs the same checks, builds dist/, uploads the distribution files as a workflow artifact, creates a GitHub Release, and publishes to PyPI through Trusted Publishing.
  • PyPI publishing does not use a stored API token. Configure a pending trusted publisher in PyPI with these values:
    • PyPI project name: ship-il-sdk
    • Owner: yair-ros
    • Repository name: ship-il-sdk
    • Workflow name: release.yml
    • Environment name: pypi

To create a GitHub Release and trigger PyPI publishing:

make release

If your virtual environment is not activated, pass the interpreter explicitly:

make release PYTHON=.venv/bin/python

Usage

from ship_il_sdk import (
    Environment,
    ShipClient,
    build_consignee_address,
    build_pickup_shipment_request_from_point,
    build_shipment_preparation,
)

client = ShipClient(
    username="YOUR_USERNAME",
    password="YOUR_PASSWORD",
    customer_id="YOUR_CUSTOMER_ID",
    environment=Environment.DEV,
)

points = client.points.get_closest_points(
    city="Tel Aviv",
    street="Herzl",
    house_number="10",
)

consignee = build_consignee_address(
    city_name="Tel Aviv",
    street_name="Herzl",
    house_number="10",
    contact_person="Dana Cohen",
    customer_name="Dana Cohen",
    phone1="0501234567",
)

preparation = build_shipment_preparation(
    consignee_address=consignee,
    number_of_packages=1,
    reference1="ORDER-123",
)

shipment = build_pickup_shipment_request_from_point(
    preparation=preparation,
    pickup_point=points.Points[0],
)

response = client.shipments.insert_pickup_shipment(shipment)
print(response.Result.TrackingNumber)

Additional shipment operations currently exposed by the SDK:

  • insert_standard_shipment(...)
  • insert_pickup_shipment(...)
  • insert_pickup_drop_shipment(...)
  • insert_picking_list(...)
  • print_wb_order_details(...)
  • get_wb_status(...)
  • get_pricing(...)

The repository no longer keeps standalone example scripts under examples/. Use scripts/integration_test.py for real DEV verification and docs/usage.md for copy-paste SDK usage patterns.

Supported Workflow

The SDK supports a generic flow that does not depend on any specific commerce platform:

  1. authenticate
  2. find closest pickup points
  3. build a shipment draft
  4. manually or heuristically choose a pickup point
  5. create the shipment
  6. download the label

For conservative automatic recommendation, use recommend_pickup_point(...). If it returns None, require manual pickup selection.

Official API References

The SDK implementation should be reviewed against the official SHIP docs:

Error Handling

from ship_il_sdk import Environment, ShipClient
from ship_il_sdk.exceptions import AuthenticationError, ShipAPIError

client = ShipClient(
    username="YOUR_USERNAME",
    password="YOUR_PASSWORD",
    customer_id="YOUR_CUSTOMER_ID",
    environment=Environment.DEV,
)

try:
    client.login()
except AuthenticationError as exc:
    print(f"Authentication failed: {exc}")

try:
    points = client.points.get_closest_points(
        city="Tel Aviv",
        street="Herzl",
        house_number="10",
    )
except ShipAPIError as exc:
    print(f"API error: {exc}")

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

ship_il_sdk-0.2.1.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

ship_il_sdk-0.2.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ship_il_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: ship_il_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ship_il_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dfb514648d6c6293f075413a1aa25de3d476cf2f44317f2c2c7cb5470ec793fe
MD5 ffdff31c03b1cf41634fc07c0c38d26c
BLAKE2b-256 e23a327c2a1c359e4377ffe24852e73a0112d704f73077b4aef2d630ec98fe39

See more details on using hashes here.

Provenance

The following attestation bundles were made for ship_il_sdk-0.2.1.tar.gz:

Publisher: release.yml on yair-ros/ship-il-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ship_il_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ship_il_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ship_il_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53c289121f91528589ea8c21f72110597c4a0199af7a423696aad1cd2485af0c
MD5 b07e2b514a019435e4ab8ce5b851f976
BLAKE2b-256 0ff5aeba203e3ab4bfc86a06f7370a243b7f34951d37b5213ae420cb4b991f82

See more details on using hashes here.

Provenance

The following attestation bundles were made for ship_il_sdk-0.2.1-py3-none-any.whl:

Publisher: release.yml on yair-ros/ship-il-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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