-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3-listado-socios-invalid-TG-id.py
executable file
·36 lines (27 loc) · 1.26 KB
/
3-listado-socios-invalid-TG-id.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
#!/usr/bin/env python
import common
print("Loading file from disk")
socios = common.readjson(filename="socios")
print("Procesando socios...")
for socio in socios:
if isinstance(socio["campsDinamics"], dict):
for field in common.telegramfields:
if field in socio["campsDinamics"]:
if (
"estat" in socio
and socio["estat"] == "COLESTVAL"
and "estatColegiat" in socio
and socio["estatColegiat"]["nom"] == "ESTALTA"
):
idsocio = f'{socio["campsDinamics"][field]}'
newidsocio = "None"
if idsocio is not None and idsocio != "" and idsocio != "None":
try:
newidsocio = int(idsocio)
except Exception:
print("Invalid ID socio for user: %s" % socio["idColegiat"])
elif idsocio != "None":
print("Invalid ID socio for user: %s" % socio["idColegiat"])
if "%s" % idsocio != "%s" % newidsocio:
print("Invalid ID socio for user: %s" % socio["idColegiat"])
print(idsocio, newidsocio)