Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import requests
import sys
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)
j = r.json()
if r.status_code != 200:
print("user {}({}) returned {}".format(l,url,r.status_code))
elif 'movedTo' in j:
print('user {} has moved to {}'.format(l, r.json()['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.