Skip to content

Commit

Permalink
refactor: bit tidier
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Jun 1, 2024
1 parent ece28a7 commit fcb0a32
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions x_notes/fetch_candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

import requests

dc_csv = "https://candidates.democracyclub.org.uk/data/export_csv/?election_date=&ballot_paper_id=&election_id=parl.2024-07-04&party_id=&cancelled=&has_twitter_username=yes&extra_fields=twitter_username&format=csv"
dc_csv = "https://candidates.democracyclub.org.uk/data/export_csv/"
params = {
"election_id": "parl.2024-07-04",
"has_twitter_username": "yes",
"extra_fields": "twitter_username",
"format": "csv",
}

r = requests.get(dc_csv, stream=True)
r = requests.get(dc_csv, params=params, stream=True)
data = list(csv.DictReader(StringIO(r.text)))
handles = [row["twitter_username"].replace('"', "") for row in data]

Expand Down

0 comments on commit fcb0a32

Please sign in to comment.