Skip to main content

banner

ocean-web3

💧 Python wrapper, allowing to integrate the basic Ocean/web3.py capabilities oceanprotocol.com

Travis (.com) Codacy coverage PyPI GitHub contributors


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.

Metadata

Release files for ocean-web3 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocean-web3 0.1.2
File Size Uploaded
ocean-web3-0.1.2.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ocean-web3 0.1.2
File Interpreter ABI Platform
ocean_web3-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 21.2 kB

Release files / ocean-web3-0.1.2.tar.gz

Download URL ocean-web3-0.1.2.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5a7021ff0a60d3b47807b592c124ea92a691babcbe32cf10878882e72b9bdaa1
BLAKE2b-256 checksum
How to use checksums
4bc70cc24aa381f304879b6964ac35d50616f69a53b3126e68fb186c40574c3a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ocean_web3-0.1.2-py2.py3-none-any.whl

Download URL ocean_web3-0.1.2-py2.py3-none-any.whl
Size 8.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1a5190c537e656b75d4dff5c7dabd49bf132e7c0fabafece6f7acd16fc6cb63d
BLAKE2b-256 checksum
How to use checksums
bfe3fd89fe1853bb9bef795c86c8f717fe98fc0c998f47a612a670d09dcf3e10
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page