'Create a personal authorization token with a note of \'ansible-galaxy login\''

def create_github_token(self):

    self.remove_github_token()
    args = json.dumps({'scopes': ['public_repo'], 'note': 'ansible-galaxy    login'})
    try:
        data = json.load(open_url(self.GITHUB_AUTH, url_username=self.github_username, url_password=self.github_password, force_basic_auth=True, data=args))
    except HTTPError as e:
        res = json.load(e)
        raise AnsibleError(res['message'])
    return data['token']
