/semuxapi-py

python client for the Semux API v2.1 - generated by Swagger

Primary LanguagePython

swagger-client

Semux is an experimental high-performance blockchain platform that powers decentralized application.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 2.1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen For more information, please visit https://www.semux.org

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/mdodong/semuxapi-py.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/mdodong/semuxapi-py.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

#! /usr/bin/env python

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
config = swagger_client.configuration.Configuration()
config.username = "YOUR_USERNAME"
config.password = "YOUR_PASSWORD"

# Configure Base URL (contingent on host version, here v2.3.0)
config.host = "http://127.0.0.1:5171/v2.3.0"

# Create an instance of the API class
client = swagger_client.api_client.ApiClient(configuration=config)
instance = swagger_client.SemuxApi(client)

# Example of API call with no parameters: get_info
#    See: https://api.semux.online/#/semux/getInfo
try:
    print()
    print("Blockchain Info")
    response = instance.get_info()
    pprint(response)
except ApiException as e:
   print("Exception when calling SemuxApi->add_node: %s\n" % e)

# Example of API call with parameters: get_block_by_hash
#    See: https://api.semux.online/#/semux/getBlockByHash
try:
    # First block
    block = "0x3658883e499adf5cc791ca47ce592bdbb012f7ba1ca5ee3935ca7d3b78e46594"
    print()
    print("Block %s" % block)
    response = instance.get_block_by_hash(block)
    pprint(response)
except ApiException as e:
   print("Exception when calling SemuxApi->add_node: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost/v2.1.0

Class Method HTTP request Description
SemuxApi add_node POST /node Add node
SemuxApi add_to_blacklist PUT /blacklist Add to blacklist
SemuxApi add_to_whitelist PUT /whitelist Add to whitelist
SemuxApi broadcast_raw_transaction POST /transaction/raw Broadcast a raw transaction
SemuxApi compose_raw_transaction GET /compose-raw-transaction Compose an unsigned raw transaction
SemuxApi create_account POST /account Create or import an account
SemuxApi delete_account DELETE /account Delete account
SemuxApi get_account GET /account Get account
SemuxApi get_account_pending_transactions GET /account/pending-transactions Get pending transactions of the account
SemuxApi get_account_transactions GET /account/transactions Get account transactions
SemuxApi get_account_votes GET /account/votes Get account votes
SemuxApi get_block_by_hash GET /block-by-hash Get block by hash
SemuxApi get_block_by_number GET /block-by-number Get block by number
SemuxApi get_delegate GET /delegate Get a delegate
SemuxApi get_delegates GET /delegates Get all delegates
SemuxApi get_info GET /info Get info
SemuxApi get_latest_block GET /latest-block Get latest block
SemuxApi get_latest_block_number GET /latest-block-number Get latest block number
SemuxApi get_peers GET /peers Get peers
SemuxApi get_pending_transactions GET /pending-transactions Get pending transactions
SemuxApi get_root GET / Get root
SemuxApi get_syncing_progress GET /syncing Get syncing progress
SemuxApi get_transaction GET /transaction Get transaction
SemuxApi get_transaction_limits GET /transaction-limits Get transaction limits
SemuxApi get_validators GET /validators Get validators
SemuxApi get_vote GET /vote Get vote
SemuxApi get_votes GET /votes Get a delegate's votes
SemuxApi list_accounts GET /accounts List accounts
SemuxApi register_delegate POST /transaction/delegate Register delegate
SemuxApi sign_message GET /sign-message Sign a message
SemuxApi sign_raw_transaction GET /sign-raw-transaction Sign an unsigned raw transaction
SemuxApi transfer POST /transaction/transfer Transfer coins
SemuxApi unvote POST /transaction/unvote Unvote
SemuxApi verify_message GET /verify-message Verify a message
SemuxApi vote POST /transaction/vote Vote

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author