The `free-proxy` library (version 1.1.3) is a Python package designed to scrape, verify, and provide free working proxies from various online sources such as sslproxies.org, us-proxy.org, and free-proxy-list.net. It allows users to filter proxies by country, anonymity, HTTPS support, and define custom timeouts, making it useful for web scraping with libraries like `requests` or `Selenium`. The library is actively maintained with regular updates.
pip install free-proxyVerified import paths — ran on the pinned version, not inferred.
Initializes `FreeProxy` to get a working proxy. The first example fetches a random proxy and tests it with `requests`. The second example demonstrates fetching an HTTPS proxy specifically from the US or Brazil. Due to the nature of free proxies, reliability can vary, and retries may be necessary.
Update your code to catch `fp.fp.FreeProxyException` instead of relying on `SystemExit` or uncontrolled program termination. Example: `try: ... except FreeProxyException as e: print(e)`.
Implement robust error handling, retry mechanisms, and consider using a pool of proxies. For critical applications, paid proxy services offer greater reliability and performance.
Regularly update the `free-proxy` library to ensure compatibility with upstream proxy source websites. If you encounter issues, check the library's GitHub for recent updates or reported issues.
Ensure you are using `free-proxy` version 1.1.1 or newer for reliable HTTPS proxy filtering.
Relax your filtering criteria (e.g., remove `country_id`, `https=True`, or increase `timeout`). Try running the script again, as proxy lists update frequently. Consider implementing retry logic with a delay.
Update `free-proxy` to version 1.0.1 or higher to resolve this specific parsing issue. Ensure that the proxy string received is correctly formatted before passing it to `requests` or other HTTP clients.
Retry with a different proxy. If using custom proxies, ensure credentials are correct. For `free-proxy`, this often means the chosen proxy is dead or blocked; try getting another one via `FreeProxy().get()`.
Implement robust retry logic (e.g., using `requests` with `urllib3.Retry`). Increase the `timeout` parameter in `FreeProxy()` and your `requests.get()` call. Fetch a new proxy if errors persist.