Forbidden error on making GET api call to https://hub.docker.com

I am using the urllib Python library to make a GET request to https://hub.docker.com just to check basic connectivity. It was working fine until last week. Now I am getting a 403 Forbidden error unless I add a User-Agent header.

Did Docker recently add this restriction? I couldn’t find any release notes about this change. it’s causing issues on our side. Any information would be helpful.

This doesn’t work, gives 403 HTTPError

import urllib.request

url = "https://hub.docker.com"
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
print(response.code)

This works

import urllib.request

url = "https://hub.docker.com"
headers = {"User-Agent": "YourCustomUserAgent"}
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request)
print(response.code)

I’m not sure if it would be added to release notes, but there is a current issue with Docker Hub caused by CloudFlare so it could also be a change on CloudFlare side.

When did you start to see this issue?

End of last week, after 13th Nov 2025

Maybe you could report it in the Hub Feedback repository:

If it was not intended, hopefully it ca be fixed. If it was intended, you can at least get some info about why it happened.

If you report it, please, share the issue link here, so we can follow it.

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