Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.