403 Client Error: Forbidden for url

Hi everyone,
I’m getting started with brownie, and I’m trying to deploy a contract on the Goerli testnet.
And I’ve set up my project id in my .env file, but I’m getting this error

Brownie v1.19.3 - Python development framework for Ethereum

BrownieProject is the active project.

Running 'scripts/deploy.py::main'...
goerli
  File "brownie/_cli/run.py", line 51, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 110, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy.py", line 26, in main
    deploySimpleStorage()
  File "./scripts/deploy.py", line 8, in deploySimpleStorage
    simple_storage = SimpleStorage.deploy({"from":account})
  File "brownie/network/contract.py", line 549, in __call__
    return tx["from"].deploy(
  File "brownie/network/account.py", line 510, in deploy
    receipt, exc = self._make_transaction(
  File "brownie/network/account.py", line 720, in _make_transaction
    gas_price, gas_strategy, gas_iter = self._gas_price(gas_price)
  File "brownie/network/account.py", line 456, in _gas_price
    return web3.eth.generate_gas_price(), None, None
  File "web3/eth.py", line 986, in generate_gas_price
    return self._generate_gas_price(transaction_params)
  File "web3/eth.py", line 214, in _generate_gas_price
    return self.gasPriceStrategy(self.web3, transaction_params)
  File "web3/gas_strategies/rpc.py", line 20, in rpc_gas_price_strategy
    return web3.manager.request_blocking(RPC.eth_gasPrice, [])
  File "web3/manager.py", line 197, in request_blocking
    response = self._make_request(method, params)
  File "web3/manager.py", line 150, in _make_request
    return request_func(method, params)
  File "web3/middleware/formatting.py", line 94, in middleware
    response = make_request(method, params)
  File "web3/middleware/gas_price_strategy.py", line 90, in middleware
    return make_request(method, params)
  File "web3/middleware/formatting.py", line 94, in middleware
    response = make_request(method, params)
  File "web3/middleware/attrdict.py", line 33, in middleware
    response = make_request(method, params)
  File "web3/middleware/formatting.py", line 94, in middleware
    response = make_request(method, params)
  File "web3/middleware/formatting.py", line 94, in middleware
    response = make_request(method, params)
  File "web3/middleware/formatting.py", line 94, in middleware
    response = make_request(method, params)
  File "web3/middleware/buffered_gas_estimate.py", line 40, in middleware
    return make_request(method, params)
  File "web3/middleware/exception_retry_request.py", line 105, in middleware
    return make_request(method, params)
  File "web3/providers/rpc.py", line 88, in make_request
    raw_response = make_post_request(
  File "web3/_utils/request.py", line 113, in make_post_request
    response.raise_for_status()
  File "requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 403 Client Error: Forbidden for url: https://goerli.infura.io/v3/<ProjectId>

And the ProjectId in the URL is the good one.

Here is my deploy function :

def deploySimpleStorage():
    account = get_account()
    simple_storage = SimpleStorage.deploy({"from":account})

and the get_account() function :

def get_account():
    print(network.show_active())
    if(network.show_active()=="development"):
        return accounts[0]
    else:
        return accounts.add(config['wallets']['from_key'])

The answer of the get_account function is the good address, the one linked with my scretKey in my .env file.
Does anyone know what is wrong with my code ?
Thanks!

1 Like

Hi @MaxenceH please check this older post

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.