API
Code Samples
from urllib.parse import urlencode
import requests
import json
# set your credentials
client_id = "XXXXXXXXXXXXXXXXXXXXXXX"
client_secret = "XXXXXXXXXXXXXXXXXXXXXXX"
# this function gets the response from our API
def post(endpoint, body):
url = "https://api.codefordemocracy.org"
response = requests.post(url+endpoint, data=json.dumps(body), auth=(client_id, client_secret))
if response.status_code == 200:
return json.loads(response.text)
return []Last updated
Was this helpful?