API reference¶
diariopy ¶
diariopy: Python interface to the Diário de Obras (diariodeobras.net) API.
DiarioError ¶
Bases: RuntimeError
Raised when an API request fails or returns an unexpected response.
Source code in src/diariopy/client.py
41 42 | |
store_token ¶
store_token(token: str) -> bool
Store the API token securely using keyring.
Returns True on success, False if the keyring is not accessible.
Source code in src/diariopy/client.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
retrieve_token ¶
retrieve_token(quiet: bool = False) -> Optional[str]
Retrieve the stored API token, or None if none is found.
Source code in src/diariopy/client.py
72 73 74 75 76 77 78 79 80 | |
perform_request ¶
perform_request(
endpoint: str,
query: Optional[dict] = None,
method: str = "GET",
body: Optional[JSON] = None,
timeout: float = 30.0,
) -> Optional[JSON]
Perform an authenticated request against the Diario API.
Returns the parsed JSON body, or None when there is no stored token or
the response has no body (e.g. 204 No Content). Raises :class:DiarioError
on transport failures, HTTP errors, or unexpected content types.
Source code in src/diariopy/client.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get_company ¶
get_company() -> JSON
Retrieve company details.
Source code in src/diariopy/client.py
150 151 152 | |
get_entities ¶
get_entities() -> JSON
Retrieve all registered entities (cadastros).
Source code in src/diariopy/client.py
155 156 157 | |
get_projects ¶
get_projects() -> JSON
Retrieve the list of projects (obras).
Source code in src/diariopy/client.py
160 161 162 | |
get_project_details ¶
get_project_details(project_id: str) -> JSON
Retrieve details of a specific project by its ID.
Source code in src/diariopy/client.py
165 166 167 168 | |
get_task_list ¶
get_task_list(project_id: str) -> JSON
Retrieve the task list (schedule items) of a specific project.
The API wraps the schedule in a cronograma field alongside summary
counters; this returns the schedule items themselves.
Source code in src/diariopy/client.py
171 172 173 174 175 176 177 178 179 180 181 | |
get_task_details ¶
get_task_details(project_id: str, task_id: str) -> JSON
Retrieve details of a specific task within a project.
Source code in src/diariopy/client.py
184 185 186 187 188 | |
get_reports ¶
get_reports(
project_id: str, limit: int = 50, order: str = "desc"
) -> JSON
Retrieve reports of a specific project.
limit is a positive integer; order is "asc" or "desc".
Source code in src/diariopy/client.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
get_report_details ¶
get_report_details(project_id: str, report_id: str) -> JSON
Retrieve details of a specific report within a project.
Source code in src/diariopy/client.py
207 208 209 210 211 | |