forked from tonylampada/eleicoes22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaixar_hashes.py
46 lines (44 loc) · 988 Bytes
/
baixar_hashes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
ufs = [
'ac',
'al',
'ap',
'am',
'ba',
'ce',
'es',
'go',
'ma',
'mt',
'ms',
'mg',
'pa',
'pb',
'pr',
'pe',
'pi',
'rj',
'rn',
'rs',
'ro',
'rr',
'sc',
'sp',
'se',
'to',
'df',
'zz',
]
for uf in ufs:
with open(f'secoes/secoes_{uf}.json') as f:
d = json.load(f)
for iabr in d['abr']:
for mu in iabr['mu']:
codmun = mu['cd']
for zon in mu['zon']:
codzon = zon['cd']
for sec in zon['sec']:
codsec = sec['ns']
url = f'https://resultados.tse.jus.br/oficial/ele2022/arquivo-urna/406/dados/{uf}/{codmun}/{codzon}/{codsec}/p000406-{uf}-m{codmun}-z{codzon}-s{codsec}-aux.json'
filename = f'hash-{uf}-m{codmun}-z{codzon}-s{codsec}.json'
print(f'wget {url} -O hashes/{filename}')