In general for programs that access the web, whether cURL, Python, etc. web servers may block HTTP User Agent that doesn’t match typical graphical web browsers.
The server filtering is often trivially overcome by setting a generic Mozilla user agent like “Mozilla/5.0”.
For cURL, this is done with the
curl -A "Mozilla/5.0" https://www.whatsmyua.info/api/v1/ua