sunlight.service – API superclass¶
This page is more aimed to API hackers, not so much API users. If you’re a user, feel free to read up on how this works, but this might not be the easiest thing to develop an app around.
Classes and Variables¶
Base service class. All API classes (such as say -
sunlight.services.openstates.OpenStates) inherit from this.
EntityDict provides a dictionary representation of an API entity along with a _meta dictionary that contains information about the query results. This could include result count and pagination details.
EntityList provides an iterable of API entities along with a _meta dictionary that contains information about the query results. This could include result count and pagination details.
Base class for all the API implementations, as well as a bunch of common code on how to actually fetch text over the network.
Get some data from the network - this is where we actually fetch something and make a request.
Be sure that API_KEY was set before calling this method. This will throw a
sunlight.errors.NoAPIKeyExceptionif the API_KEY is not set.
top_level_object(str): Thing to query for (such as say,
- “bills” for OpenStates )
- These arguments will be passed to the underlying API implementation to help create a query. Validation will happen down below, and on a per-API level.