I'm getting error trying to get node status

I need help please. Running the following code using REST-API gives me undesired error.

print(json.dumps(status, indent=4))

Here is error I got.

Traceback (most recent call last):
  File "c:/Users/OWNER/Documents/algoContract/contract.py", line 18, in <module>
    status = algod_client.status()
  File "C:\Users\OWNER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\algosdk\v2client\algod.py", line 142, in status
    return self.algod_request("GET", req, **kwargs)
  File "C:\Users\OWNER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\algosdk\v2client\algod.py", line 79, in algod_request
    raise error.AlgodHTTPError(e, code)
algosdk.error.AlgodHTTPError: {"message":"Forbidden"}
PS C:\Users\OWNER\Documents\algoContract>```

This most likely comes from a wrong algod token.
Can you check the URL and token match your algod instance?

1 Like

Yes they did matched.

Can you provide a minimum code exhibiting the issue?
Can you also show the output of goal node status and goal version -v?

Iā€™m actually using Purestake API

Which URL are you using?

PureStake API v2 URL are different from v1 URL: ps1 must be replaced by ps2.
See https://developer.purestake.io/apiupdates

1 Like

Yes I am using ps2 .I really do not know why it is that way. Sometimes, I feel like the environment is dynamic. I might run a code and it throws error, running it again without any fix may run perfectly. Its weird.

Can you please provide a minimum example with the issue?
Just replace the token by xxxxx

OK will post shortly.