This is the BlockTrail Python SDK. This SDK contains methods for easily interacting with the BlockTrail API. Below are examples to get you started. For additional examples, please see our official documentation at https://www.blocktrail.com/api/docs/lang/python
As is best practice with financial data, The API returns all values as an integer, the Bitcoin value in Satoshi's.
The BlockTrail SDK has some easy to use functions to do this for you, we recommend using these and we also strongly recommend doing all Bitcoin calculation and storing of data in integers and only convert to/from Bitcoin float values for displaying it to the user.
import blocktrail
print "123456789 Satoshi to BTC: ", blocktrail.to_btc(123456789)
print "1.23456789 BTC to Satoshi: ", blocktrail.to_satoshi(1.23456789)
A bit more about this can be found in our documentation.
You can install the package through Pypi (https://pypi.python.org/pypi/blocktrail-sdk).
$ pip install blocktrail-sdk
or you can use setuptools
$ python setup.py build
$ python setup.py install
one of the dependancies, pycrypto
needs to be compiled and requires the python dev headers so make sure you have those installed.
$ apt-get install python-dev
Python 2.7 is thoroughly tested.
Python 3.2 is not supported by the future
library, so atm we don't support it either.
Python 3.3 and 3.4 unit tests pass, but it needs some testing...
The following dependancies are required / installed:
- httpsig (for signing our requests to the API)
- pycrypto (for crypto stuff)
- requests (for doing the requests to the API)
- future (for supporting both python 2 and 3)
- six (for supporting both python 2 and 3)
Please visit our official documentation at https://www.blocktrail.com/api/docs/lang/python for the usage.
Be sure to visit the BlockTrail API official documentation website for additional information about our API.
If you find a bug, please submit the issue in Github directly. BlockTrail-PHP-SDK Issues
As always, if you need additional assistance, drop us a note at [email protected].
Unit Tests are created with PyUnit and can be ran with python setup.py test
The BlockTrail Python SDK is released under the terms of the MIT license. See LICENCE.md for more information or see http://opensource.org/licenses/MIT.