File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 2
2
import io
3
3
import urllib .parse
4
4
import zipfile
5
+ from logging import info
5
6
6
7
from urllib3 import PoolManager
7
8
@@ -10,9 +11,12 @@ def get_number_of_visitors(language: str, http: PoolManager) -> int:
10
11
params = urllib .parse .urlencode (
11
12
{'filters' : f'[["contains","event:page",["/{ language } /"]]]' , 'period' : 'all' }
12
13
)
13
- r = http .request ('GET' , f'https://plausible.io/docs.python.org/export?{ params } ' )
14
+ response = http .request (
15
+ 'GET' , f'https://plausible.io/docs.python.org/export?{ params } '
16
+ )
17
+ info (f'visitors { response .status = } ({ language = } )' )
14
18
with (
15
- zipfile .ZipFile (io .BytesIO (r .data ), 'r' ) as z ,
19
+ zipfile .ZipFile (io .BytesIO (response .data ), 'r' ) as z ,
16
20
z .open ('visitors.csv' ) as csv_file ,
17
21
):
18
22
csv_reader = csv .DictReader (io .TextIOWrapper (csv_file ))
You can’t perform that action at this time.
0 commit comments