7

I am looking to integrate EOS to Python based command line tooling and server side backends.

As EOS is young project and information is still dispersed, I am looking for more insight than a Google search what kind of Python toolchains and utilities there exist for EOS at the moment?

Notably I found this project for testing and deploying smart contracts - http://eosfactory.io/sphinx/build/html/ - I ideally would like to run py.test based end-to-end test suites against my smart contract codebase.

1

I ran into github to answer your question and found a very interesting project.

https://github.com/learnforpractice/pyeos

| improve this answer | |
3

I am trying to use EOS rpc APIs by python. So, I started with my own wrapper for python. This is the link.
It is in very early stage. If you want to contribute, you are very welcome.

When we push a transaction from command line, it requires only one command but while using rpc APIs you have to make multiple request to push a transaction. So, for that I have written a separate class where you can push a transaction using only one function. Do try that and let me know your views.

HTH

| improve this answer | |
2

I would like to add to JavaHead1560's answer by recommending the use of shlex package, which correctly deals with cases with quoted contents inside command.

import shlex, json
import subprocess
from subprocess 

def do_cmd(command):
    return subprocess.check_output(shlex.split(command))

info = json.loads(do_cmd("cleos system buyram account1 account2 '1 EOS' -j"))
| improve this answer | |
1

you can run the different programs (cleos/nodeos/keosd) in python like you can run any other command:

#!/usr/bin/python
import subprocess
import smtplib
from subprocess import PIPE

def do_cmd(command):
    return subprocess.check_output(command.split(" "))
do_cmd("cleos -u http://mainnet.genereos.io get info")

Alternatively here's a link to the API documentation: https://developers.eos.io/eosio-nodeos/reference#get_info

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.