def getUserData(self, access_token): response = urlutils.get("https://api.github.com/user?access_token=%s" % access_token) if response.status_code != 200: return None data = response.json() if data is None or "login" not in data: return None return { "account": data["login"], "username": data["login"], "email": data.get("email"), "fullname": data.get("name"), }
def getUserData(self, access_token): response = urlutils.get("https://api.github.com/user?access_token=%s" % access_token) if response.status_code != 200: return None data = response.json() if data is None or "login" not in data: return None return { "account": data["login"], "username": data["login"], "email": data.get("email"), "fullname": data.get("name") }
def getUserData(self, access_token): response = urlutils.get( "https://www.googleapis.com/oauth2/v3/userinfo", params={ "access_token": access_token }, verify=False) if response.status_code != 200: return None data = response.json() if data is None or "email" not in data: return None email = data["email"] username = email.partition("@")[0] return { "account": email, "username": username, "email": email, "fullname": data.get("name", username) }
def getUserData(self, access_token): response = urlutils.get( "https://www.googleapis.com/oauth2/v3/userinfo", params={"access_token": access_token}, verify=False) if response.status_code != 200: return None data = response.json() if data is None or "email" not in data: return None email = data["email"] username = email.partition("@")[0] return { "account": email, "username": username, "email": email, "fullname": data.get("name", username) }