Skip to content

Commit 6f54f9a

Browse files
committed
Retry on 500 in visitors module
1 parent 773032d commit 6f54f9a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

visitors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
import zipfile
55
from logging import info
66

7-
from urllib3 import PoolManager
7+
from urllib3 import PoolManager, Retry
88

99

1010
def get_number_of_visitors(language: str, http: PoolManager) -> int:
1111
params = urllib.parse.urlencode(
1212
{'filters': f'[["contains","event:page",["/{language}/"]]]', 'period': 'all'}
1313
)
1414
response = http.request(
15-
'GET', f'https://plausible.io/docs.python.org/export?{params}'
15+
'GET',
16+
f'https://plausible.io/docs.python.org/export?{params}',
17+
retries=Retry(status_forcelist=(500,)),
1618
)
1719
info(f'visitors {response.status=} ({language=})')
1820
with (

0 commit comments

Comments
 (0)