Coverage for conf/settings/spectacular.py: 88%
6 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
1from textwrap import dedent
3from conf.settings.base import INSTALLED_APPS
4from conf.settings.misc import API_VERSION
7if "drf_spectacular" not in INSTALLED_APPS: 7 ↛ 10line 7 didn't jump to line 10 because the condition on line 7 was always true
8 INSTALLED_APPS.append("drf_spectacular")
10SPECTACULAR_SETTINGS = {
11 "TITLE": "Openverse API",
12 "DESCRIPTION": dedent(
13 """
14 Openverse is a search engine for openly-licensed media. The Openverse
15 API is a system that allows programmatic access to public domain digital
16 media. It is our ambition to index and catalog billions of
17 openly-licensed works, including articles, songs, videos, photographs,
18 paintings, and more.
20 Using this API, developers will be able to access the digital commons in
21 their own applications. You can see some examples of
22 [apps built with Openverse](https://docs.openverse.org/api/reference/made_with_ov.html)
23 in our docs.
24 """
25 ),
26 "TOS": "https://docs.openverse.org/terms_of_service.html",
27 "CONTACT": {
28 "name": "Openverse",
29 "email": "openverse@wordpress.org",
30 },
31 "LICENSE": {
32 "name": "MIT License",
33 "url": "https://github.com/WordPress/openverse/blob/main/LICENSE",
34 },
35 "VERSION": API_VERSION,
36 "EXTERNAL_DOCS": {
37 "description": "Openverse documentation",
38 "url": "http://docs.openverse.org/api/user/index.html",
39 },
40 "SERVE_INCLUDE_SCHEMA": False,
41 "SORT_OPERATION_PARAMETERS": False,
42 "EXTENSIONS_INFO": {
43 "x-logo": {
44 "url": "https://raw.githubusercontent.com/WordPress/openverse/HEAD/documentation/meta/brand/logo.svg",
45 "backgroundColor": "#fafafa",
46 }
47 },
48 "TAGS": [
49 {
50 "name": "auth",
51 "description": dedent(
52 """
53 Openverse provides free and open access to the Openverse API to
54 anonymous and registered users. [Refer to the API documentation
55 site for information on how to register](https://api.openverse.org/v1/#tag/auth).
57 All Openverse API users are subject to rate limits and restrictions
58 on how much of Openverse's dataset can be accessed through the API.
59 [Individuals should contact Openverse to request expanded access to
60 the API](https://github.com/WordPress/openverse#keep-in-touch).
61 Requests are considered on a case-by-case basis and are subject to
62 evaluation in light of [Openverse's Terms of Service](https://docs.openverse.org/terms_of_service.html).
63 Escalated access may be revoked at any time.
65 To authenticate yourself, you must sign up for an API key using
66 the `register` endpoint and then get an access token using the
67 `token` endpoint. Read on to know about these endpoints.
69 In subsequent requests, include your access token as a bearer
70 token in the `Authorization` header.
72 ```
73 Authorization: Bearer <access_token>
74 ```
76 ### Rate limits
78 Openverse endpoints are rate limited. Anonymous requests should be
79 sufficient for most users. Indeed, https://openverse.org itself
80 operates using anonymous requests from the browser.
82 Registered users are automatically granted slightly higher limits.
83 Further increases to rate limits are available upon request (see above).
85 Every Openverse API response that was subject to rate-limits includes
86 headers outlining the permitted and available usage. Exceeding the limit
87 will result in '429: Too Many Requests' responses.
89 ### Pagination
91 Openverse's dataset is valuable, and the
92 [Terms of Service](https://docs.openverse.org/terms_of_service.html)
93 disallow scraping under all circumstances. As such, pagination
94 for anonymous users is limited, accommodating only the typical
95 usage on https://openverse.org. Pagination is limited in terms
96 of the size of individual pages and the total number of works
97 visible for a query (pagination depth).
99 Authenticated users are subject to the same limit of total works
100 available for a query, but may request larger individual pages.
102 Increases to pagination limits on page size and total depth are
103 available upon request (see above).
104 """
105 ),
106 },
107 {
108 "name": "audio",
109 "description": "These are endpoints pertaining to audio files.",
110 },
111 {
112 "name": "images",
113 "description": "These are endpoints pertaining to images.",
114 },
115 ],
116 "REDOC_UI_SETTINGS": {
117 "theme": {
118 "logo": {"gutter": "20px"},
119 "typography": {"headings": {"fontFamily": "inherit", "fontWeight": 700}},
120 }
121 },
122}