delete image after upload
This commit is contained in:
parent
83bf83560e
commit
e7145c4d8f
1 changed files with 2 additions and 1 deletions
3
main.py
Executable file → Normal file
3
main.py
Executable file → Normal file
|
@ -3,7 +3,7 @@ from mastodon import Mastodon
|
||||||
import twitter
|
import twitter
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import sqlite3, json, re, random
|
import sqlite3, json, re, random, os
|
||||||
|
|
||||||
cfg = {
|
cfg = {
|
||||||
"cw":None,
|
"cw":None,
|
||||||
|
@ -137,4 +137,5 @@ open(filename, 'wb').write(requests.get(image).content)
|
||||||
# post!
|
# post!
|
||||||
media = client.media_post(filename, description="Image downloaded from Twitter account {}".format(acct))
|
media = client.media_post(filename, description="Image downloaded from Twitter account {}".format(acct))
|
||||||
client.status_post("Source: https://twitter.com/{}/status/{}".format(acct, chosen_tweet[0]), media_ids=media)
|
client.status_post("Source: https://twitter.com/{}/status/{}".format(acct, chosen_tweet[0]), media_ids=media)
|
||||||
|
os.remove(filename)
|
||||||
|
|
||||||
|
|
Reference in a new issue