think i fixed it
This commit is contained in:
parent
e593c71fc1
commit
2e3c034eed
@ -1,7 +1,8 @@
|
|||||||
name: QuotesBot
|
name: QuotesBot
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '35 */4 * * *'
|
# - cron: '35 */4 * * *'
|
||||||
|
- cron: '04 * * * *'
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -15,7 +16,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
- name: Run Script
|
- name: Run app.py
|
||||||
run:
|
run:
|
||||||
python app.py
|
python app.py
|
||||||
env:
|
env:
|
||||||
|
2
app.py
2
app.py
@ -14,8 +14,8 @@ if source_object.reason == "OK":
|
|||||||
reader = csv.DictReader(io.StringIO(source_object.text))
|
reader = csv.DictReader(io.StringIO(source_object.text))
|
||||||
source_data = dumps(list(reader))
|
source_data = dumps(list(reader))
|
||||||
choices = loads(source_data)
|
choices = loads(source_data)
|
||||||
print(choices[0])
|
|
||||||
choice = choices[randint(0, len(choices) - 1)]
|
choice = choices[randint(0, len(choices) - 1)]
|
||||||
headers = {'Authorization': 'Bearer ' + post_token}
|
headers = {'Authorization': 'Bearer ' + post_token}
|
||||||
payload = {'status': f"{choice['quote']}\n\n - {choice['author']}\n\n#RandomQuote #quotes #quote #bot", 'visibility': 'public'}
|
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)
|
response = post(post_endpoint, headers=headers, data=payload)
|
||||||
|
print(response.reason, loads(response.text)['url'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user