Verify
analyze_api_maturity(uri, doc_endpoint=None)
async
Analyze the maturity level of a REST API using Richardson's maturity model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri |
str
|
The base URI of the API. |
required |
doc_endpoint |
str
|
The endpoint where the documentation is available. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing feedback on the API's maturity level according to Richardson's maturity model. |
Source code in apilyzer/verify.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
check_documentation_json(uri, doc_endpoint=None)
async
Check if the given base URI of an API has REST API documentation available. If the documentation endpoint is not specified, the function will try to identify it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri |
str
|
The base URI of the API. |
required |
doc_endpoint |
str
|
The endpoint where the documentation is available. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing the 'status', 'message', and 'response' keys detailing the outcome of the check. |
Examples:
>>> import asyncio
>>> asyncio.run(check_documentation_json('http://127.0.0.1:8000'))
{'status': 'success', 'message': 'REST API JSON documentation found at http://127.0.0.1:8000/', 'response': '{...}'}
Source code in apilyzer/verify.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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 148 149 150 151 152 153 154 155 156 157 158 159 | |
estimate_rate_limit(uri, max_requests)
async
Analyze the rate limit of a REST API using multiple requests in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri |
str
|
The base URI of the API. |
required |
max_requests |
int
|
The max quantity of requests the users want to test. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing feedback on how the API was able to support multiple parallel requests. |
Examples:
>>> import asyncio
>>> asyncio.run(estimate_rate_limit('http://127.0.0.1:8000', 100))
{'status': 'success', 'message': 'The API returned a 429 error (too many requests). This indicates that the rate limit has been exceeded'}
Source code in apilyzer/verify.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |