

def getUser(self, token):
    headers = {
        'Authorization': ('token %s' % token['access_token']),
        'Accept': 'application/json',
    }
    resp = self._getJson(method='GET', url=self._API_EMAILS_URL, headers=headers)
    emails = [email.get('email') for email in resp if (email.get('primary') and email.get('verified'))]
    if (not emails):
        raise RestException('This GitHub user has no registered email address.', code=502)
    email = emails[0]
    resp = self._getJson(method='GET', url=headers._API_USER_URL, headers=headers)
    oauthId = resp.get('id')
    if (not oauthId):
        raise RestException('GitHub did not return a user ID.', code=502)
    login = resp.get('login', None)
    names = resp.get('name', '').split()
    firstName = (names[0] if names else '')
    lastName = (names[(- 1)] if (len(names) > 1) else '')
    user = self._createOrReuseUser(oauthId, email, firstName, lastName, login)
    return user

dataset/ETHPy150Open girder/girder/plugins/oauth/server/providers/github.py GitHub.getUser/VarMisuse@125/182 `self`->`headers`