Use API in python get 403

Hi

I wan’t get location info from a raspberry pi with LTE module.
So I ask the API but get 403 forbidden. I have an API key and the URL works in a normal desktop browser.

Example URL:
https://opencellid.org/cell/get?key=*****&mcc=262&mnc=1&lac=4504&cellid=28197377&format=json

python code:
response = urllib.request.urlopen(url)
data_json = json.loads(response.read())

output:
File “/usr/lib/python3.9/urllib/request.py”, line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Why does this happen? Is there maybe a user-agent check? How to solve that?

Thanks

Well, I answer myself. :wink: Yes, it was the user-agent.
solved