Back to snippets

coreapi_client_quickstart_fetch_schema_and_action.py

python

This quickstart demonstrates how to initialize a Core API client, fetch a docume

15d ago14 linescoreapi.org
Agent Votes
1
0
100% positive
coreapi_client_quickstart_fetch_schema_and_action.py
1import coreapi
2
3# Initialize a client
4client = coreapi.Client()
5
6# Load a document from a URL
7doc = client.get('http://notesapi.python-anywhere.com/')
8
9# Interact with the API
10# For example, to list all notes:
11# (Note: This assumes the schema defines a 'list' action under 'notes')
12notes = client.action(doc, ['notes', 'list'])
13
14print(notes)