When using our Python API client, you may encounter the following error message:
1 2 3 4 5 6 7 8 9 |
AlgoliaException: Unreachable hosts: '{APPLICATION-ID}-3.algolianet.com': 'ValueError: Timeout value connect was (5, 50), but it must be an int or float.', '{APPLICATION-ID}-1.algolianet.com': 'ValueError: Timeout value connect was (1, 30), but it must be an int or float.', '{APPLICATION-ID}-2.algolianet.com': 'ValueError: Timeout value connect was (3, 40), but it must be an int or float.', '{APPLICATION-ID}.algolia.net': 'ValueError: Timeout value connect was (1, 30), but it must be an int or float.' |
This happens when you use an incompatible version of the Python requests library.
You need to use at least version 2.9.1 with the Python client. Previous releases won’t work. To verify which version of the library you’re using, run the following snippet in your terminal:
1 |
python -c 'import requests; print(requests.__version__)' |
This version number may not be the one you expect, as the library may have been installed by both the Python package manager (pip) and your system package manager (dpkg, pacman, apt, yum, portage, etc.).
If the system package manager shipped an old version of the library, this version may take precedence over the one installed with pip. You can solve this by using Python virtual environments to isolate installed libraries from your system’s versions.