Skip to main content

Python SDK for merchant REST API

Project description

PSPark Python SDK usage

You should have jwt-key and api-key keys to be able to use our API via this SDK. A jwt-key is a CSR file.

Generating a CSR file

A Certificate Signing Request (.csr) file is required to authenticate an API user and to get your API-Key. The .csr file contains your API public key that will be used to validate the request signature. To generate your RSA 4096 private key (stored in pspakr_secret.key) for signing requests, use the following command line:

openssl req -new -newkey rsa:4096 -nodes -keyout pspakr_secret.key -out pspark_public_key.csr

Make sure you keep the API secret key (pspark_secret.key) safe and secure. Do not share your API secret key with anyone. To get your API-key you should upload your pspark_public_key in the cabinet.pspark.io.

Installation

pip install pspark-sdk

Request examples

Bellow shown a simple example of SDK usage.

from pspark import PSPark
from pspark.requests import BalancesRequest


sdk = PSPark(jwt_key='jwt-key', api_key='api-key')

response = sdk.get_balances(BalancesRequest())

For async request you have to use PSParkAsync.

import asyncio
from pspark import PSParkAsync
from pspark.requests import TransactionRequest


sdk = PSParkAsync(jwt_key='jwt-key', api_key='api-key')

async def async_main():
    response = await sdk.get_transaction_status(TransactionRequest(
        wallet_id="08a03be1-aefa-4695-8186-b52411b4f240",
        reference="7555e4a7-f464-43b1-859e-950f445dc7d4",
    ))


asyncio.run(async_main())

More request examples can find here.

Validation errors

The API doesn't implement all RESTFull API requirements and has its own response structure.

All HTTP responses from the server will have 200 status code. So, if your request will have some validation errors, the code, and it's description will be presented in the response body as shown bellow.

Response Example

{
  "code": 1002,
  "message": "error description",
  "data": {
    //... some data
  }
}

Each time when the server's response will have some validation errors, the SDK will throw ResponseValidationError.

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

pspark_sdk-0.0.19.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

pspark_sdk-0.0.19-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file pspark_sdk-0.0.19.tar.gz.

File metadata

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

File hashes

Hashes for pspark_sdk-0.0.19.tar.gz
Algorithm Hash digest
SHA256 029ff099e45f035a54ab79d2398b312dca5c448d05391e5098e37ad8f6491a17
MD5 b91012961cf37a42e380ed8002d55950
BLAKE2b-256 e5703a9b2adfae1bdbf449eb7f03af264b67ea948b9d795938e7a03c2517bdd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pspark_sdk-0.0.19.tar.gz:

Publisher: pypi-publish.yml on ps-park/sdk-python

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

File details

Details for the file pspark_sdk-0.0.19-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pspark_sdk-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 6d03cdae9ac6935b7216912a54a25cb854549d9f6e13da35c834544facde53b8
MD5 0ac7b2a750fd3a414e3abc20c60db81f
BLAKE2b-256 db85a45cdb1e7802d673b37d22096b996aaab478809afe4d62afa0221cd4e5fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pspark_sdk-0.0.19-py3-none-any.whl:

Publisher: pypi-publish.yml on ps-park/sdk-python

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