Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xadahiya/b7a8aa7f986e0feeb3ceacbb7b7dee76 to your computer and use it in GitHub Desktop.
Save xadahiya/b7a8aa7f986e0feeb3ceacbb7b7dee76 to your computer and use it in GitHub Desktop.
"""
Example from the README
"""
def main():
the_iri_of_the_resource = 'http://www.markus-lanthaler.com/hydra/event-api/events/102'
from hydra import Resource, SCHEMA
res = Resource.from_iri(the_iri_of_the_resource)
get_event = res.find_suitable_operation(None, None, SCHEMA.Event)
resp, body = get_event()
print(body)
assert resp.status == 201, "%s %s" % (resp.status, resp.reason)
new_event = Resource.from_iri(resp['location'])
print(new_event)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment