We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b86ee6 commit 639dffaCopy full SHA for 639dffa
src/cloudflare_middleware/__init__.py
@@ -3,6 +3,7 @@
3
import ipaddress
4
import re
5
6
+import requests.exceptions
7
from CloudFlare import CloudFlare
8
from CloudFlare.exceptions import CloudFlareAPIError
9
from starlette.requests import Request
@@ -175,7 +176,8 @@ async def get_ip_ranges() -> tuple[list[str], list[str]]:
175
176
ipv4_cidrs = response.get('result', {}).get('ipv4_cidrs', DEFAULT_IPV4)
177
ipv6_cidrs = response.get('result', {}).get('ipv6_cidrs', [])
178
return ipv4_cidrs, ipv6_cidrs
-
179
+ except requests.exceptions.ConnectionError:
180
+ return [], []
181
except CloudFlareAPIError:
182
return [], []
183
0 commit comments