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.16.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.16-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pspark_sdk-0.0.16.tar.gz
Algorithm Hash digest
SHA256 64abe19cba9b8b152d46e35e9cbd05cd4c0df45251ea2a0dad92e16499ff7f69
MD5 2161afb48ac393908ed0a491ceeb86f8
BLAKE2b-256 f1e0c79015b49643a40cc9655b8aa054d8173b5895cb19d6e037fd4ffa020d69

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pspark_sdk-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 1fefda4b914148478dd124517dafd67bea1a0162550b9980801001496428f608
MD5 a786d27b2fafdcc1841c6ef52d0dcb4c
BLAKE2b-256 9065e8dd02d1d69d9f1e8e275adf7e61b37ea30097660a1102677d366595da26

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