Skip to content

Instantly share code, notes, and snippets.

@tom-montgomery
Last active January 15, 2019 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tom-montgomery/6734a96226b22416c9aa799fef5c4c54 to your computer and use it in GitHub Desktop.
Save tom-montgomery/6734a96226b22416c9aa799fef5c4c54 to your computer and use it in GitHub Desktop.
# update socrata asset's DOI metadata
headers = {'Host': 'data.austintexas.gov',
'Accept': """*/*""",
'Content-Length': '6000',
'Content-Type': 'application/json',
'X-App-Token': os.environ['socrata_doi_app_token']}
url = 'https://data.austintexas.gov/api/views/metadata/v1/{}'.format(socrata_4x4)
data = {"customFields": {"Digital Object Identifer (DOI)": {"DOI Number": "https://doi.org/{}".format(doi)}}}
r2 = requests.patch(url, json=data, auth=(os.environ['socrata_doi_user'], os.environ['socrata_doi_pass']), headers=headers)
print(r2.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment