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.17.tar.gz (11.7 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.17-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pspark_sdk-0.0.17.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pspark_sdk-0.0.17.tar.gz
Algorithm Hash digest
SHA256 9d742688b5dbe01bb6a5baaf24dda13a4251eb9385a9959fd166e081a136306a
MD5 0f95cc75978914f5388def638d55126b
BLAKE2b-256 ae804cf005e48f44a4ab8158882c324cf19f17ed1e9792a9aa205e013ca86c01

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pspark_sdk-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pspark_sdk-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 274547d6140620c1021861b5fb4f2d40b9b4c165be19c16662282735f7146348
MD5 cf58d2127191e1c28260bf9d63a31209
BLAKE2b-256 f4a99049133e0d5218b3b1f99bd13f0eb0629f88476d0ea73aa22b5297d09d23

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