-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove tutor ID from associate field
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
import configparser | ||
import os | ||
|
||
import requests | ||
|
||
import common | ||
|
||
config = configparser.ConfigParser() | ||
config.read(os.path.expanduser("~/.avast.ini")) | ||
|
||
|
||
idtutor1 = "0_13_20231012041710" | ||
idtutor2 = "0_14_20231012045321" | ||
idsocios = "0_16_20241120130245" | ||
|
||
|
||
socios = common.readjson("socios") | ||
|
||
|
||
token = common.gettoken( | ||
user=config["auth"]["RWusername"], password=config["auth"]["RWpassword"] | ||
) | ||
headers = {"Authorization": f"Bearer {token}"} | ||
|
||
|
||
print("Procesando socios") | ||
count = 0 | ||
|
||
idsociotoclean = [] | ||
|
||
for socio in socios: | ||
if isinstance(socio["campsDinamics"], dict): | ||
if idsocios in socio["campsDinamics"]: | ||
mysocio = socio["campsDinamics"][idsocios] | ||
for field in [idtutor1, idtutor2]: | ||
if field in socio["campsDinamics"]: | ||
if mysocio == socio["campsDinamics"][field]: | ||
idsociotoclean.append(socio["idColegiat"]) | ||
|
||
for idcolegiat in sorted(set(idsociotoclean)): | ||
count = count + 1 | ||
print( | ||
"%s https://asociacionavast.playoffinformatica.com/FormAssociat.php?idColegiat=%s" | ||
% (f"{count:04}", idcolegiat) | ||
) | ||
|
||
comurl = f"{common.apiurl}/colegiats/{idcolegiat}/campsdinamics" | ||
|
||
data = {f"{idsocios}": ""} | ||
|
||
files = [] | ||
response = requests.request("PUT", comurl, headers=headers, data=data, files=files) | ||
|
||
print(response) |