Last active
April 3, 2018 20:00
-
-
Save Jess3Jane/76048ba714797815cc9166e41dc32f80 to your computer and use it in GitHub Desktop.
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
import requests | |
import sys | |
import json | |
with open(sys.argv[1]) as fp: | |
for l in fp.read().split("\n"): | |
parts = l.split("@") | |
if len(parts) != 2: continue | |
url = "https://{}/@{}.json".format(parts[1], parts[0]) | |
try: | |
r = requests.get(url) | |
if r.status_code != 200: | |
print("user {}({}) returned {}".format(l,url,r.status_code)) | |
else: | |
j = json.loads(r.text) | |
if "movedTo" in j: | |
print("user {} ({}) moved to {}".format(l, url, j["movedTo"])) | |
except Exception as e: | |
print("user {}({}) has some other error {}".format(l,url,e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment