Eth2 : urllib.error.HTTPError: HTTP Error 400: Bad Request

Hi, wondering why am I getting urllib.error.HTTPError: HTTP Error 400: Bad Request for the following .

url = “https://eth2-beacon-pyrmont.infura.io/eth/v1/beacon/states/{head}/root
response = urllib.request.urlopen(url)

works for url = "https://eth2-beacon-pyrmont.infura.io/eth/v1/beacon/headers" without any error.

Should be just head instead of {head} . Not sure why the choice of bracket, {}, to indicate a variable !! Often <> is used for the same purpose. .

1 Like

Hi @whatdhack, and welcome to the Infura community! Glad you figured out the problem, and thanks for posting your solution for others who may run into this same issue!