Licenses
The Licenses resource provides information about the licenses that govern the use of data in OpenAQ. You can use it to get details about each license’s permissions and restrictions, such as whether attribution is required and whether commercial use, modification, or redistribution is allowed. This resource is most helpful to identify licensing requirements and ensure compliance with OpenAQ’s Terms of Use.
Methods
Section titled “Methods”The Licenses resource provides the following methods:
get()- For accessing a single license by license ID.list()- For accessing multiple licenses.
Get a single license
Section titled “Get a single license”The get() method accepts one single licenses_id as an argument and returns
details about that license in a LicensesResponse object.
get( licenses_id: int ) -> LicensesResponseQuery arguments
Section titled “Query arguments”| argument | description | input requirements |
|---|---|---|
| licenses_id | int OpenAQ’s unique ID for each license | Required |
Example
Section titled “Example”from openaq import OpenAQ
# Retrieve the license with ID 10with OpenAQ(api_key="replace-me-with-a-valid-key") as client: client.licenses.get(licenses_id=10)List multiple licenses
Section titled “List multiple licenses”The list() method takes optional arguments and returns licenses on the OpenAQ
platform that meet all the conditions specified in a LicensesResponse object.
If no argument is included, the method returns all licenses using the default
arguments.
list( page: int = 1, limit: int = 1000, order_by: str | None = None, sort_order: SortOrder | None = None ) -> LicensesResponseQuery arguments
Section titled “Query arguments”| argument | description | input requirements |
|---|---|---|
| page | int The page number to retrieve, defaults to 1 | Must be greater than zero |
| limit | int The number of results returned per page, defaults to 1,000 | Must be between 1 and 1,000 |
| order_by | str | None The license field by which to sort results, defaults to id. Currently only id is supported | |
| sort_order | str | None The sort direction for the order_by field, defaults to desc | Must be one of: asc, desc, ASC, DESC |
Example
Section titled “Example”from openaq import OpenAQ
# List all licenses on OpenAQwith OpenAQ(api_key="your-api-key") as client: client.licenses.list()Response object
Section titled “Response object”The Licenses objects in the results of the LicensesResponse contain attributes
that have all data about them. The hierarchy below presents the depth of the
attributes and their datatypes.
results[] ├── id: int ├── name: str ├── commercial_use_allowed: bool ├── attribution_required: bool ├── share_alike_required: bool ├── modification_allowed: bool ├── redistribution_allowed: bool └── source_url: str