🐳 Ocean/Web3py wrapper.
Project description
ocean-web3
💧 Python wrapper, allowing to integrate the basic Ocean/web3.py capabilities oceanprotocol.com
Table of Contents
Features
Ocean-web3 include the methods to make easy the connection with contracts deployed in different networks. This repository include also the methods to encrypt and decrypt information.
Prerequisites
You should have running a instance of BigchainDB and ganache-cli. You can start running the docker-compose in the docker directory:
Quick-start
When you want to interact with the contracts you have to instantiate this class:
from ocean_web3.ocean_contracts import OceanContractsWrapper
ocean = OceanContractsWrapper(host='http://localhost', port=8545, config_path='config.ini')
ocean.init_contracts()
If you do not pass the config_path the wrapper will use the default values. After that you have to init the contracts. And you can start to use the methods in the different contracts.
You will find as well two methods that allow you to register and consume an asset.
from ocean_web3.consumer import register, consume
register(publisher_account=ocean.web3.eth.accounts[1],
provider_account=ocean.web3.eth.accounts[0],
price=10,
ocean_contracts_wrapper=ocean,
json_metadata=json_consume
)
consume(resource=resouce_id,
consumer_account=ocean.web3.eth.accounts[1],
provider_account=ocean.web3.eth.accounts[0],
ocean_contracts_wrapper=ocean,
json_metadata=json_request_consume)
Code style
The information about code style in python is documented in this two links python-developer-guide and python-style-guide.
Testing
Automatic tests are setup via Travis, executing tox
.
Our test use pytest framework.
New Version
The bumpversion.sh
script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.
License
Copyright 2018 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ocean-web3-0.1.2.tar.gz
.
File metadata
- Download URL: ocean-web3-0.1.2.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a7021ff0a60d3b47807b592c124ea92a691babcbe32cf10878882e72b9bdaa1 |
|
MD5 | 6a28fea55d2cf59908286e6d05b702dd |
|
BLAKE2b-256 | 4bc70cc24aa381f304879b6964ac35d50616f69a53b3126e68fb186c40574c3a |
File details
Details for the file ocean_web3-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: ocean_web3-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5190c537e656b75d4dff5c7dabd49bf132e7c0fabafece6f7acd16fc6cb63d |
|
MD5 | c67ab8553bc76d08073a6fb06820765b |
|
BLAKE2b-256 | bfe3fd89fe1853bb9bef795c86c8f717fe98fc0c998f47a612a670d09dcf3e10 |