Hugging Face Support Request: DNS Resolution Issue in Spaces Environment

Subject: DNS Resolution Error for External API (api.wit.ai) in Hugging Face Spaces

Problem Description

I’m experiencing a DNS resolution failure when trying to connect to api.wit.ai from a Hugging Face Space. The same code works perfectly on my local machine but fails within the Spaces environment.

Error Details

text

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.wit.ai', port=443): Max retries exceeded with url: /speech?v=20221114 (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f253016a710>: Failed to resolve 'api.wit.ai' ([Errno -2] Name or service not known)"))

Code Example (Working Locally)

python

import requests

# This works on local machine but fails in Hugging Face Space
response = requests.post(
    'https://api.wit.ai/speech?v=20221114',
    headers={'Authorization': 'Bearer MY_TOKEN'},
    files={'audio': audio_file}
)
1 Like

Some external APIs are reportedly being intentionally blocked. (From HF Discord)
You might want to contact HF about it. website@huggingface.co