Created
September 5, 2017 16:12
-
-
Save amane-katagiri/8aab19bcd4022202bdf0a6afbc01be19 to your computer and use it in GitHub Desktop.
Delete tweets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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