Skip to content

Instantly share code, notes, and snippets.

@Jess3Jane
Last active April 3, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Jess3Jane/76048ba714797815cc9166e41dc32f80 to your computer and use it in GitHub Desktop.
Save Jess3Jane/76048ba714797815cc9166e41dc32f80 to your computer and use it in GitHub Desktop.
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