mirror of
https://github.com/karl0ss/downgrangefixtures_ical.git
synced 2025-05-09 08:29:04 +01:00
add launch.json to gitignore
This commit is contained in:
parent
1b34e39547
commit
32b2486d8e
5
.github/workflows/python-app.yml
vendored
5
.github/workflows/python-app.yml
vendored
@ -31,8 +31,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
poetry install --no-interaction --no-root
|
poetry install --no-interaction --no-root
|
||||||
- name: Get Latest Fixtures
|
- name: Get Latest Fixtures
|
||||||
|
env:
|
||||||
|
TELEGRAM_BOT_API_KEY: ${{ secrets.TELEGRAMBOTID }}
|
||||||
|
TELEGRAM_BOT_CHAT_ID: ${{ secrets.TELEGRAMCHATID }}
|
||||||
run: |
|
run: |
|
||||||
poetry run python main.py
|
poetry run python main.py
|
||||||
- name: Commit Changes
|
- name: Commit Changes
|
||||||
run: |
|
run: |
|
||||||
if ! git diff-index --quiet HEAD; then
|
if ! git diff-index --quiet HEAD; then
|
||||||
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.vscode/launch.json
|
14
main.py
14
main.py
@ -3,6 +3,18 @@ from icalendar import Calendar, Event
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
|
|
||||||
|
telegram_bot_api_key = USER = os.getenv('TELEGRAM_BOT_API_KEY')
|
||||||
|
telegram_bot_chat_id = USER = os.getenv('TELEGRAM_BOT_CHAT_ID')
|
||||||
|
|
||||||
|
def send_message(message:str)->None:
|
||||||
|
"""Send message to me on Telegram when updated.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
message (str): String of message to send.
|
||||||
|
"""
|
||||||
|
requests.post(f'https://api.telegram.org/bot{telegram_bot_api_key}/sendMessage', json={'chat_id': telegram_bot_chat_id, 'text': message})
|
||||||
|
|
||||||
def store_df_as_csv(df:pd.DataFrame)->None:
|
def store_df_as_csv(df:pd.DataFrame)->None:
|
||||||
"""Store dataframe as a CSV file.
|
"""Store dataframe as a CSV file.
|
||||||
@ -81,9 +93,11 @@ if exists:
|
|||||||
print("Fixtures updated, ical updated")
|
print("Fixtures updated, ical updated")
|
||||||
store_df_as_csv(df)
|
store_df_as_csv(df)
|
||||||
create_ical_file(df, cal)
|
create_ical_file(df, cal)
|
||||||
|
send_message("Fixtures updated, ical updated")
|
||||||
else:
|
else:
|
||||||
print("Fixtures not updated, no update to ical")
|
print("Fixtures not updated, no update to ical")
|
||||||
else:
|
else:
|
||||||
store_df_as_csv(df)
|
store_df_as_csv(df)
|
||||||
create_ical_file(df, cal)
|
create_ical_file(df, cal)
|
||||||
|
send_message("New ical file created")
|
||||||
print("New ical file created")
|
print("New ical file created")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user