py-common is an implementation of the sdk-go-common in Python.
Welcome for any kind of contributions, such as open issues, fix bugs and improve documentation.
The following command will install py-common in your python environment.
$ python setup.py install # install py-common
Note: Before using the py-common in your application, you need to make the following preparations:
Build dynamic link library with sdk-go-common encryption tools(Ubuntu users can go through this step because library file is installed by default). To build this library, you need to install golang and download sdk-go-common. For more details please refer to sdk-go-common.
Copy the library file utils.so into your py-common installation path cryption/utils
.
If you have no idea where your py-common is installed, use the following command to check it out (you need to leave the py-common code repo before running this command).
$ python -c 'import imp;print imp.find_module("cryption")[1]'
/usr/local/lib/python2.7/site-packages/py_common-2.0-py2.7.egg/cryption
In this case, you should create directory /usr/local/lib/python2.7/site-packages/py_common-2.0-py2.7.egg/cryption/utils/
, and copy the file into this path.
.
├── py_common-2.0-py2.7.egg
| └── cryption
| └── utils
| └── utils.so
To communicate with the server through HTTPS protocol, you need to download a CA certificate, register api-key and download the corresponding zip-file including client private key and cert from your ArxanChain BaaS Chainconsole. Refer to API cert management for more details.
Finaly, you will get three files as following. Please pay special attention to the absolute path which will be used to create a client.
.
├── your path
| └── rootca.crt
| └── api-key.key
| └── api-key.pem
The following command will run unit test.
$ pytest