think i fixed it
This commit is contained in:
parent
e593c71fc1
commit
2e3c034eed
@ -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
2
app.py
@ -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'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user