I'm minting the NFT with the Python SDK of Thirdweb using Goerli TestNet.
Code :
sdk = ThirdwebSDK.from_private_key(PRIVATE_KEY, NETWORK)
NFT_COLLECTION_ADDRESS = contratonft
nft_collection = sdk.get_nft_collection(NFT_COLLECTION_ADDRESS)
urlarchivoarr=imagencert.split("/")
urlarchivostr=str(urlarchivoarr[1]);
urlarchivoimg="https://files.avfenixrecords.com/" + urlarchivostr
metadata=NFTMetadataInput.from_json({
"name": nombrecert,
"description": descripcert,
"image": urlarchivoimg
})
# You can pass in any address here to mint the NFT to
# xxxxx is the goerli wallet
tx = nft_collection.mint_to("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", metadata)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
idnft=tx.id
Error:
[2022-11-14 21:02:10,706] ERROR in app: Exception on /api/contracts/v1/mintnft [POST]
Traceback (most recent call last):
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "app.py", line 1849, in mintnft
tx = nft_collection.mint_to("0x98E0463643b28E24223d2B5EF19E78A9AF031505", metadata)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/contracts/nft_collection.py", line 166, in mint_to
receipt = self._contract_wrapper.send_transaction("mint_to", [to, uri])
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/thirdweb/core/classes/contract_wrapper.py", line 112, in send_transaction
nonce = provider.eth.get_transaction_count(signer.address)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/manager.py", line 197, in request_blocking
response = self._make_request(method, params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/manager.py", line 150, in _make_request
return request_func(method, params)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/gas_price_strategy.py", line 90, in middleware
return make_request(method, params)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/attrdict.py", line 33, in middleware
response = make_request(method, params)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/buffered_gas_estimate.py", line 40, in middleware
return make_request(method, params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/middleware/exception_retry_request.py", line 105, in middleware
return make_request(method, params)
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/providers/rpc.py", line 88, in make_request
raw_response = make_post_request(
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/web3/_utils/request.py", line 49, in make_post_request
response.raise_for_status()
File "/home/ombhkqgo/virtualenv/contratos/3.8/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://eth-goerli.g.alchemy.com/v2/[redacted]
I thought it was a cache or temporary issue of Thirdweb but it persists. I changed :
tx = nft_collection.mint(metadata)
to
tx = nft_collection.mint_to("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", metadata)
without success.
What version of the Python SDK are you using? I would suggest upgrading to the latest version (2.1.0).
This issue looks like its coming up because your SDK is still using the old public alchemy RPC endpoint, which has since been shut down/blocked.
We updated our SDK to use different RPC endpoints in later versions which should be working still.