Errors and Cloudflare¶
All errors inherit FutureNewsError.
| Exception | When |
|---|---|
BlockedError |
HTTP 403, usually a Cloudflare challenge |
AuthRequiredError |
an authenticated endpoint was called without auth_token (raised before any request) |
AuthenticationError |
HTTP 401: token invalid or expired |
RateLimitError |
HTTP 429; see .retry_after |
APIError |
any other HTTP error |
ConnectionFailure |
network failure or timeout |
Getting past a Cloudflare block¶
Future News sits behind Cloudflare. If you get BlockedError, pass your own browser cookie or a proxy. This library never ships cookies:
FutureNews(cookies={"cf_clearance": "<from your browser>"}, proxy="http://user:pass@host:port")
Warning
Treat cookies like passwords. Never commit them.
Full signatures: API reference.