Skip to content

Commit

Permalink
better RECEIVERS formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanVnucec committed Apr 17, 2021
1 parent 115e65c commit 811daf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ openWeatherApiKey: <OpenWeather API key>
```
2. Create `RECEIVERS.txt` and put email subscribers as:
```
<email>, "<location name>"
example1@gmail.com, "Zagreb"
example2@gmail.com, "Berlin"
example3@gmail.com, "Milwaukee"
example4@gmail.com, "Mobile, Alabama"
example5@gmail.com, "Nashville, Tennessee"
example6@gmail.com, "Nashville, Indiana"
<email>, <location name>
example1@gmail.com, Zagreb
example2@gmail.com, Berlin
example3@gmail.com, Milwaukee
example4@gmail.com, Mobile, Alabama
example5@gmail.com, Nashville, Tennessee
example6@gmail.com, Nashville, Indiana
```
3. Activate virtualenv.
4. Install dependencies from `requirements.txt`.
Expand Down
7 changes: 3 additions & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ def get_receivers():
locations = {}

for line in lines:
line = line.partition(',')
receiver = line[0].strip()
location = line[2].replace('"', '').strip()
receiver, _, location = line.partition(',')
receiver = receiver.strip()
location = location.strip()

if not location in locations:
# create key, create empty list, append to list email
locations[location] = []

locations[location].append(receiver)
Expand Down

0 comments on commit 811daf8

Please sign in to comment.