Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
danbryan committed Sep 2, 2023
1 parent 1be57e3 commit d1db637
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
14 changes: 7 additions & 7 deletions integrations/google-calendar-urls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ Integrate with the `cosmos-upgrades` API to fetch upgrade events and add them to

![image](https://github.com/DefiantLabs/cosmos-upgrades/assets/807940/4b431117-df3c-4049-aadf-f892b521e428)


## Prerequisites 📜

1. Python 3.6+
2. Required Python libraries. Install them using:
```bash
pip install -r requirements.txt
```

```bash
pip install -r requirements.txt
```

## Customizing Monitored Networks 🎛️

By default, the tool monitors a preset list of mainnets and testnets. If you're interested in specific networks, you can easily customize the list:

1. Open `config.json` in the project directory.

2. Modify the list of networks under `mainnets` or `testnets` as required. Ensure network names are separated by a space.

For example, to only monitor the `osmosis` and `akash` mainnets:
Expand All @@ -52,9 +52,9 @@ By default, the tool monitors a preset list of mainnets and testnets. If you're
## Code Overview 🧠

- `get_events_from_api()`: Fetches the upgrade events from the `cosmos-upgrades` API.

- `create_google_calendar_event(event_data)`: Takes the event data, formats it, and provides a URL to create the event in Google Calendar.

- `main()`: Primary function that orchestrates the fetching and calendar event creation.

## Support & Contributions 🤝
Expand Down
12 changes: 5 additions & 7 deletions integrations/google-calendar-urls/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ def get_events_from_api():
def create_google_calendar_event(event_data):
event_title = f"{event_data['network']} - {event_data['type']} - {event_data['version']}"
details_url = f"https://www.mintscan.io/{event_data['network']}/blocks/{event_data['upgrade_block_height']}"

start_datetime = datetime.strptime(event_data['estimated_upgrade_time'], '%Y-%m-%dT%H:%M:%S.%f').replace(tzinfo=pytz.utc)
local_datetime = start_datetime.astimezone(tz.tzlocal()) # Using dateutil's tzlocal

end_datetime = start_datetime + timedelta(minutes=30)

start_time_str = start_datetime.strftime('%Y%m%dT%H%M%SZ')
end_time_str = end_datetime.strftime('%Y%m%dT%H%M%SZ')

google_cal_url = f"https://www.google.com/calendar/render?action=TEMPLATE&text={urllib.parse.quote(event_title)}&dates={start_time_str}/{end_time_str}&details={urllib.parse.quote(details_url)}&sf=true&output=xml"

s = pyshorteners.Shortener()
short_google_cal_url = s.tinyurl.short(google_cal_url)

Expand All @@ -61,5 +61,3 @@ def main():

if __name__ == "__main__":
main()


0 comments on commit d1db637

Please sign in to comment.