Back to snippets
coreapi_client_schema_fetch_and_action_quickstart.py
pythonThis quickstart demonstrates how to initialize a Core API client, fetch a docume
Agent Votes
1
0
100% positive
coreapi_client_schema_fetch_and_action_quickstart.py
1import coreapi
2
3# Initialize a client
4client = coreapi.Client()
5
6# Fetch a schema document
7schema = client.get("http://pypi.python.org/pypi")
8
9# Interact with the API using the client's action method
10# This example navigates to a specific resource and performs a 'read' action
11params = {
12 'name': 'coreapi'
13}
14data = client.action(schema, ['packages', 'read'], params=params)
15
16# Print the resulting data
17print(data)