Skip to main content

PulseChain Scanner API Client

Overview

This project is a Python client for interacting with the PulseChain Scanner API. It provides a main Client class along with several subclients that focus on specific areas of the PulseChain API, such as addresses, blocks, transactions, tokens, and more. This comprehensive client is designed to make it easy to perform various operations on the PulseChain blockchain, such as fetching block information, interacting with smart contracts, and retrieving token-related data.

Features

  • Unified API client for the PulseChain ecosystem.
  • Modular architecture with individual subclients for different API endpoints.
  • Supports paginated responses for large datasets.
  • Custom exception handling for better error management.
  • Easy configuration and usage.

Documentation

Full documentation is available at Read the Docs.

Installation

To use the PulseChain API client, you need Python 3.10 or higher. You can install the necessary dependencies by running:

pip install python-pulsechain

Usage

Initializing the Client

To begin interacting with the PulseChain API, you first need to instantiate the main Client class:

from pulsechain.client import Client
client = Client()

The Client class provides easy access to multiple subclients:

  • stats: For interacting with statistics endpoints.
  • addresses: For interacting with addresses and related data.
  • transactions: For handling transaction-related queries.
  • tokens: For working with tokens and NFTs.
  • blocks: For retrieving block details.
  • search: For performing search operations.
  • smart_contracts: For interacting with smart contracts.

Example Usage

Below are some examples of how to use the client to perform common tasks.

Fetch General Statistics

response = client.stats.get_stats()
print(response.items)

Get Information About an Address

response = client.addresses.get_info("0x123...")
print(response.items)

Search for Tokens by Name

response = client.tokens.get_tokens(name_query="PLS")
print(response.items)

Fetch Transactions for a Specific Block

response = client.blocks.get_block_txns("1234567")
print(response.items)

Paginated Responses

To support paginated responses, the response contains field next_page_params that can be used to fetch the next page of results. It needs to be passed as a named paramter to functions that fetch paginated responses.

Example:

response = client.blocks.get_block_txns("1234567")
print(response.items)
next_page = client.blocks.get_block_txns("1234567", next_page_params=response.next_page_params)

Custom Error Handling

This client raises custom exceptions defined in exceptions.py to make error handling more intuitive:

  • PulseChainAPIException: Generic API error.
  • PulseChainTimeoutException: Raised when a request to the API times out.
  • PulseChainServerError: Raised when the API returns an internal server error (500).
  • PulseChainBadRequestException: Raised when the client makes an invalid request (400).
  • PulseChainUnprocessableEntityException: Raised when the server cannot process the request (422).

Example:

try:
    stats = client.stats.get_stats()
except PulseChainAPIException as e:
    print(f"An error occurred: {e}")

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests to enhance the client.

Contact

For questions or support, please open an issue on the repository or reach out to the maintainers.

Support

If you find this project helpful and would like to support its development, consider sending PLS to the following address:

0xaC6f36D3B4B8aEA37D0B1363d35cb8D024deF1BC

Metadata

Release files for python-pulsechain 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-pulsechain 0.3.1
File Size Uploaded Provenance Actions
python_pulsechain-0.3.1.tar.gz 24.9 kB Without provenance Details for python_pulsechain-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-pulsechain 0.3.1
File Interpreter ABI Platform Actions
python_pulsechain-0.3.1-py3-none-any.whl Python 3 none any Details for python_pulsechain-0.3.1-py3-none-any.whl

Total release size: 68.8 kB

Release files / python_pulsechain-0.3.1.tar.gz

Download URL python_pulsechain-0.3.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f8106fe2ccae30a1c9ea77b7607f0b45d9261fd4f942c750345866d11da00dc9
BLAKE2b-256 checksum
How to use checksums
93a1ba1cb535784fa179edb269fb34c41de46c78548e6780bd86004785cfe348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.2 Windows/10

Release files / python_pulsechain-0.3.1-py3-none-any.whl

Download URL python_pulsechain-0.3.1-py3-none-any.whl
Size 43.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ece489497718ac6aef7197ab0c3ac1947427eb769e746b6b23402974df75f9f
BLAKE2b-256 checksum
How to use checksums
f94fef2e1c7c819b9722027ec10e5139e8d0c138f63544c61358ea96cd378fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.2 Windows/10

Security for python-pulsechain 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page