Skip to content

Commit

Permalink
Modifications for officeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
martinszy committed Jun 11, 2024
1 parent 0b990d8 commit 4981359
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
32 changes: 32 additions & 0 deletions mexico2024-officeholders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"country:": "Mexico",
"SHEET_ID": "1VG_5C-Pti-S5CJUmwVaKIeetiN4N2NTMqxM7kIlfcb4",
"ST_RANGES": {
"area": "A1:J1191",
"chamber": "A1:C1190",
"role": "A1:F1190",
"contest": "A1:G1190",
"coalition": "A1:D128",
"party": "A1:F93",
"profession": "A1:B122",
"url_types": "B2:B23"
},
"CAPTURE_SHEET_ID": "1h-l_TadufHO49hWQ_TnkQ2Bb0DiQncXWC6cE-pPzR1M",
"READ_RANGE": "Captura!A1:AW5000",
"COALITION_URL_RANGE": "URL_logo_partido_coal!A1:H37",
"PARTY_URL_RANGE": "URL_logo_partido_coal!I1:R62",
"person_header": [
"person_id",
"full_name",
"first_name",
"last_name",
"date_birth",
"gender",
"dead_or_alive",
"last_degree_of_studies",
"contest_id",
"profession_1",
"replaced_person_id",
"is_elected_2024"
]
}
3 changes: 2 additions & 1 deletion mexico2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"last_degree_of_studies",
"contest_id",
"profession_1",
"replaced_person_id"
"replaced_person_id",
"is_elected_2024"
]
}
5 changes: 3 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ def get_dummy_data(endpoint):
"contest_id": -1,
"person_id": -1,
"profession_1": '',
"replaced_person_id": None
"replaced_person_id": None,
"is_elected_2024": False
}
elif endpoint == "other-name":
dummy_data = {
Expand Down Expand Up @@ -742,7 +743,7 @@ def send_data(base_url, endpoint, dataset):
r = requests.post(full_url, json=row, headers=HEADERS)
if r.status_code != 201:
print(f"[ERROR]: {endpoint} #{i} status code: {r.status_code}")
print(f"msg: {r.json()['message']}")
print(f"msg: {r.json()['message']} | data:{row}")
except r_excepts.ConnectionError:
print("[CONNECTION ERROR]")
print(f"#{i} | url: {full_url} | data:{row}")
Expand Down

0 comments on commit 4981359

Please sign in to comment.