Skip to content

Instantly share code, notes, and snippets.

@amane-katagiri
Created September 5, 2017 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amane-katagiri/8aab19bcd4022202bdf0a6afbc01be19 to your computer and use it in GitHub Desktop.
Save amane-katagiri/8aab19bcd4022202bdf0a6afbc01be19 to your computer and use it in GitHub Desktop.
Delete tweets.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from requests_oauthlib import OAuth1Session
CK = "CONSUMER_KEY"
CS = "CONSUMER_SECRET"
AT = "ACCESS_TOKEN"
AS = "ACCESS_SECRET"
def main(id, twitter):
url = "https://api.twitter.com/1.1/statuses/destroy/{}.json".format(id)
req = twitter.post(url, params={"id": int(id)})
print(url, end=" ")
if req.status_code == 200:
print("OK")
else:
print("Error: %d" % req.status_code)
if __name__ == "__main__":
t = OAuth1Session(CK, CS, AT, AS)
if len(sys.argv) > 1:
for x in sys.argv[1:]:
main(x, t)
else:
try:
while True:
main(input(), t)
except EOFError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment