Skip to content

Instantly share code, notes, and snippets.

@ottonomy
Created January 17, 2019 22:54
Show Gist options
  • Save ottonomy/f57eedf634cc2a51404d53bab188bbd0 to your computer and use it in GitHub Desktop.
Save ottonomy/f57eedf634cc2a51404d53bab188bbd0 to your computer and use it in GitHub Desktop.
import json
import requests
def add_assertion(access_token, badgeclass_entity_id, data):
import pdb; pdb.set_trace();
headers = {'Authorization': "Bearer " + access_token}
url = "https://api.badgr.io/v2/badgeclasses/{}/assertions".format(badgeclass_entity_id)
response = requests.request('POST', url, headers=headers, timeout=15, json=data)
print response.text
content = json.loads(response.text)
if not content["status"]["success"]:
print content["status"]["description"]
return content['result']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment