Python Forum

Full Version: How do I get the in3.Client() to create a variable with attributes? (in3 pypi pckge)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using Python 3 and the in3 imported package, how do I get the in3.Client() to create a variable with attributes .account and .contract? I am using Python 3. The last two lines of this code (taken from https://pypi.org/project/in3/) fail:

import in3
in3_client = in3.Client()
block_number = in3_client.eth.block_number()
print(block_number) 
in3_client  # incubed network api 
in3_client.eth  # ethereum api
in3_client.account  # ethereum account api
in3_client.contract  # ethereum smart-contract api
I expect in3_client.account and in3_client.contract to work (or have a value). I get an error like this:

Quote: AttributeError: module 'in3_client' has no attribute 'account'

I tried to find out what member objects the in3_client instance/object has. I ran this:

>>> in3_client = in3.Client()
>>> print(in3_client.__dict__.keys())
dict_keys(['_runtime', 'eth', '_factory'])
Based on the above result, I see no "account" or "contract" (but I do see _runtime, eth, and _factory. How can .account and .contract be attributes of a variable created from in3.Client()? The documentation here indicates it should work.
Don't know anything about ethereum, but I see some similar names under the eth object. Perhaps the docs are out of date or typoed?

So would instead be:

in3_client.eth  # ethereum api
in3_client.eth.account  # ethereum account api
in3_client.eth.contract  # ethereum smart-contract api
Thanks. That helped.