Closed nocibambi closed 1 year ago
Since you're getting a 401 back, I would guess that your infura key is wrong, but to check, what happens if you do:
import os
os.environ["WEB3_INFURA_PROJECT_ID"] = INFURA-KEY
from web3.auto.infura import w3
w3.isConnected()
w3.isConnected()
should return True
. If it doesn't, it's likely that there is something wrong with your infura connection.
I also notice that you're using web3.py v5.31 with Python 3.10. You may need to downgrade your Python version in order to get things to work correctly. Python 3.10 isn't supported until web3.py v6.
@nocibambi - ethPM
is being considered for removal with the next major web3.py
version. Are you still using it, or have you found another solution?
I don't use it. I went through the docs to learn how to use web3.py
.
`pip freeze` output
What was wrong?
I tried to recreate the ethPM example from the documentation:
I received the following error:
```python-traceback --------------------------------------------------------------------------- HTTPError Traceback (most recent call last) File ~/.virtualenvs/blockchain-scripts/lib/python3.10/site-packages/ipfshttpclient/http_requests.py:123, in ClientSync._do_raise_for_status(self, response) 122 try: --> 123 response.raise_for_status() 124 except requests.exceptions.HTTPError as error: # type: ignore[attr-defined] File ~/.virtualenvs/blockchain-scripts/lib/python3.10/site-packages/requests/models.py:1021, in Response.raise_for_status(self) 1020 if http_error_msg: -> 1021 raise HTTPError(http_error_msg, response=self) HTTPError: 401 Client Error: Unauthorized for url: https+ip4://ipfs.infura.io:5001/api/v0/version?stream-channels=true The above exception was the direct cause of the following exception: StatusError Traceback (most recent call last) /home/andras/Projects/Blockchain/scripts/web.py/web3.py-examples-ethPM.py in line 8 26 w3.enable_unstable_package_management_api() 27 w3.pm.set_registry("ens.snakecharmers.eth") ----> 28 ens_package = w3.pm.get_package("ethregistrar", "3.0.0") File ~/.virtualenvs/blockchain-scripts/lib/python3.10/site-packages/web3/pm.py:537, in PM.get_package(self, package_name, version) 535 self._validate_set_registry() 536 release_data = self.get_release_data(package_name, version) --> 537 return self.get_package_from_uri(URI(release_data.manifest_uri)) File ~/.virtualenvs/blockchain-scripts/lib/python3.10/site-packages/web3/pm.py:342, in PM.get_package_from_uri(self, manifest_uri) 332 def get_package_from_uri(self, manifest_uri: URI) -> Package: 333 """ 334 Returns a `Package