Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
2eeaa34401
|
|||
9bd34aeb2a
|
|||
99d307a2a7
|
|||
b412eafc97
|
|||
2e3c034eed
|
@ -15,7 +15,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:
|
||||||
|
3
app.py
3
app.py
@ -14,8 +14,9 @@ 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)
|
||||||
|
print(loads(response.text)['url'])
|
||||||
|
Reference in New Issue
Block a user