Python client for NEM NIS API ( XEM\NEM\Crypto
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Python client for NEM NIS API.


Install all required dependencies into your virtualenv (if you want to use it):

pip install git+


Client implements methods from NEM API by calling appropriate method. Method names are consist of API parent parts and related resources (where hyphens and slashes replaced with underscore). Its mean, that following API resource - namespace/root/page is implemented as client.namespace.root_page and node/info is, etc.

Almost all methods are implemented this way, except few that has either super-long names or duplicate names. Simply discover all methods to see exact namings. There is 6 API parent resource entities for usage:

  • Account
  • BlockChain
  • Node
  • Namespace
  • Transaction
  • Debug

Extended code guide for available classes can be found here.

Few call can be used directly from Client instance. To perform calls to the NEM NIS API, ensure you have access to running NIS instance. By default NIS uses 7890 port, you can initialize NIS client with other address.


Examples of usage:

from nemnis import Client, explain_status

nis = Client()

hb = nis.heartbeat()

status = nis.status()


# you can use following function to get verbose message for status






### You can connect to other nodes just by passing it address:
new_client =  Client('')

new_hb = new_client.heartbeat()



All responses are requests.Response objects from requests library. You can perform all required manipulations after receiving them: convert to JSON, check status code etc.

You also can perform call via call method from Client:

from nemnis import Client

nis = Client()'GET', 'heartbeat')'GET', 'account/get', params={'address':'SOMEADDRESS'})'POST', 'local/chain/blocks-after', payload={'height': 100})

Also, each parent resource can be initialized separately by passing client instance as parameter:

from nemnis import Client, Node

nis = Client()

node = Node(nis)

node_info =



Asynchronous Usage

On Python 3.4.2 and above, the python-nis-client supports asynchronous requests using the aiohttp library. Each method returns an asyncio coroutine returning a response object; otherwise, the API is identical to the standard client.

Three helper functions are also provided for the asynchronous API: - loop() Returns the asyncio event loop. - run(future) Evaluate a single asyncio coroutine or future. - map(futures) Evaluate a sequence of asyncio coroutines or futures.

Examples of usage:

import nemnis

# get our client
nis = nemnis.AsyncioClient()

# request a single NIS resource
hb =

# request many NIS resources asynchronously
hb = nis.heartbeat()
status = nis.status()
responses =[hb, status])
print([i.json() for i in responses]))

Special thanks to Alex Huszagh for contributing async client part. Have fun!