think i fixed it

This commit is contained in:
Camille Frantz 2025-06-05 19:01:02 +00:00
parent e593c71fc1
commit 2e3c034eed
Signed by: fyrfli
SSH Key Fingerprint: SHA256:0rb3/fMYNySVgUgOqOdmFnb+qhrk1C0Rc/Ak3AoyJug
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,8 @@
name: QuotesBot
on:
schedule:
- cron: '35 */4 * * *'
# - cron: '35 */4 * * *'
- cron: '04 * * * *'
jobs:
deploy:
runs-on: ubuntu-latest
@ -15,7 +16,7 @@ jobs:
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run Script
- name: Run app.py
run:
python app.py
env:

2
app.py
View File

@ -14,8 +14,8 @@ if source_object.reason == "OK":
reader = csv.DictReader(io.StringIO(source_object.text))
source_data = dumps(list(reader))
choices = loads(source_data)
print(choices[0])
choice = choices[randint(0, len(choices) - 1)]
headers = {'Authorization': 'Bearer ' + post_token}
payload = {'status': f"{choice['quote']}\n\n - {choice['author']}\n\n#RandomQuote #quotes #quote #bot", 'visibility': 'public'}
response = post(post_endpoint, headers=headers, data=payload)
print(response.reason, loads(response.text)['url'])