404
8 |Page not found
9 |├── .codecov.yml ├── .coveragerc ├── .flake8 ├── .gitignore ├── .isort.cfg ├── .travis.yml ├── LICENSE.md ├── README.md ├── apistar ├── __init__.py ├── cli.py ├── client │ ├── __init__.py │ ├── auth.py │ ├── client.py │ ├── debug.py │ ├── decoders.py │ ├── encoders.py │ └── transports.py ├── compat.py ├── core.py ├── document.py ├── exceptions.py ├── schemas │ ├── __init__.py │ ├── autodetermine.py │ ├── config.py │ ├── jsonschema.py │ ├── openapi.py │ └── swagger.py └── themes │ ├── apistar │ ├── static │ │ ├── css │ │ │ ├── base.css │ │ │ ├── bootstrap.min.css │ │ │ └── font-awesome-4.0.3.css │ │ ├── fonts │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── img │ │ │ ├── favicon.ico │ │ │ ├── grid.png │ │ │ ├── gripper.png │ │ │ └── logomarque-small-white.png │ │ └── js │ │ │ ├── api.js │ │ │ ├── bootstrap.min.js │ │ │ └── jquery-1.10.2.min.js │ └── templates │ │ ├── index.html │ │ ├── langs │ │ ├── javascript.html │ │ └── python.html │ │ └── layout │ │ ├── content.html │ │ ├── link.html │ │ └── sidebar.html │ ├── redoc │ ├── LICENSE.md │ ├── static │ │ └── js │ │ │ └── redoc.standalone.js │ └── templates │ │ └── index.html │ └── swaggerui │ ├── LICENSE.md │ ├── static │ ├── css │ │ ├── swagger-ui.css │ │ └── swagger-ui.css.map │ └── js │ │ ├── swagger-ui-bundle.js │ │ ├── swagger-ui-bundle.js.map │ │ ├── swagger-ui-standalone-preset.js │ │ ├── swagger-ui-standalone-preset.js.map │ │ ├── swagger-ui.js │ │ └── swagger-ui.js.map │ └── templates │ └── index.html ├── docs-theme ├── 404.html ├── __init__.py ├── base.html ├── content.html ├── css │ ├── base.css │ ├── bootstrap-custom.min.css │ ├── font-awesome.min.css │ └── highlight.css ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── img │ ├── GitHub-Mark-Light-32px.png │ ├── apistar-block.png │ ├── discourse-header-img-strapline.png │ ├── discourse-header-img.png │ ├── favicon.ico │ ├── favicon.png │ ├── grid.png │ ├── logomarque-144.png │ ├── logomarque-512.png │ ├── logomarque-small-dark.png │ ├── logomarque-small-white.png │ ├── logomarque.png │ └── og-image.jpg ├── js │ ├── base.js │ ├── bootstrap-3.0.3.min.js │ ├── highlight.pack.js │ └── jquery-1.10.2.min.js ├── keyboard-modal.html ├── license │ └── highlight.js │ │ └── LICENSE ├── main.html ├── mkdocs_theme.yml ├── nav-sub.html ├── nav.html ├── search-modal.html └── toc.html ├── docs ├── CNAME ├── api-documentation.md ├── client-library.md ├── img │ ├── api-docs.png │ ├── apistar.gif │ ├── apistar.png │ ├── benchmarks.png │ ├── ident-44-square-light.png │ └── logo-200-square-light.png ├── index.md ├── making-api-requests.md ├── schema-validation.md └── type-system.md ├── mkdocs.yml ├── requirements.txt ├── scripts ├── README.md ├── ci ├── lint ├── publish ├── setup └── test ├── setup.py ├── testcases ├── jsonschema │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── allOf.json │ ├── anyOf.json │ ├── default.json │ ├── definitions.json │ ├── dependencies.json │ ├── enum.json │ ├── items.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ └── uniqueItems.json ├── openapi │ ├── api-with-examples.yaml │ ├── callback-example.yaml │ ├── link-example.yaml │ ├── petstore-expanded.yaml │ ├── petstore.yaml │ └── uspto.yaml └── swagger │ ├── api-with-examples.yaml │ ├── petstore-expanded.yaml │ ├── petstore-minimal.yaml │ ├── petstore-simple.yaml │ ├── petstore-with-external-docs.yaml │ ├── petstore.yaml │ ├── swagger.json │ └── uber.yaml └── tests ├── client ├── test_auth.py ├── test_client.py └── test_decoders.py ├── core ├── test_docs.py ├── test_parse.py └── test_validate.py ├── schemas ├── __init__.py ├── test_openapi.py └── test_swagger.py └── test_cli.py /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: "80...100" 5 | 6 | status: 7 | project: yes 8 | patch: no 9 | changes: no 10 | 11 | comment: off 12 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [report] 2 | exclude_lines = 3 | # Have to re-enable the standard pragma 4 | pragma: nocover 5 | 6 | # Don't complain if tests don't hit defensive assertion code: 7 | raise NotImplementedError 8 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .cache 3 | .coverage 4 | .git 5 | .mypy_cache 6 | .pytest_cache 7 | __pycache__ 8 | /*.egg-info 9 | /htmlcov 10 | /venv 11 | /build 12 | /dist 13 | coverage.xml 14 | test.db 15 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | atomic=true 3 | multi_line_output=5 4 | not_skip=__init__.py 5 | known_standard_library=types 6 | known_third_party=pytest 7 | known_first_party=apistar 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: xenial 3 | language: python 4 | 5 | cache: pip 6 | 7 | python: 8 | - "3.6" 9 | - "3.7" 10 | - "3.8" 11 | - "3.9" 12 | 13 | install: 14 | - pip install -U -r requirements.txt 15 | 16 | script: 17 | - scripts/lint 18 | - scripts/test 19 | 20 | after_script: 21 | - codecov 22 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright © 2017-present, [Encode OSS Ltd](http://www.encode.io/). 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
5 | 🛠 The Web API toolkit. 🛠 6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
API Star is BSD licensed code.
Designed & built in Brighton, England.
118 |
119 |
120 |
{% if True %}var url = new URL("{{ link.url }}");
2 | {% endif %}
3 | {%- if link.get_body_field() and not link.get_expanded_body() %}var data = ...;
4 | {% endif %}
5 | {%- if link.get_body_field() and link.get_expanded_body() %}var data = {
6 | {% for key, schema in link.get_expanded_body().items() %} {{ key }}: ...{% if not loop.last %},{% endif %}
7 | {% endfor %}};
8 | {% endif %}
9 | {%- if True %}var options = {
10 | method: "{{ link.method }}"
11 | {%- if link.get_body_field() %},
12 | body: JSON.stringify(data),
13 | headers: {
14 | "content-type": "application/json"
15 | }{% endif %}
16 | };
17 | {% endif %}
18 | {%- if link.get_query_fields() %}url.search = new URLSearchParams({
19 | {% for field in link.get_query_fields() %} {{ field.name }}: ...{% if not loop.last %},{% endif %}
20 | {% endfor %}});
21 | {% endif %}
22 | fetch(url, options).then(function(response) {
23 | if (!response.ok) {
24 | throw new Error(response.statusText);
25 | }
26 | console.log(response.json());
27 | })
28 |
29 |
--------------------------------------------------------------------------------
/apistar/themes/apistar/templates/langs/python.html:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | url = "{{ link.url }}"{% raw %}
4 | {% endraw %}
5 | {%- if link.get_query_fields() %}params = {
6 | {% for field in link.get_query_fields() %} "{{ field.name }}": ...{% if not loop.last %},{% endif %}
7 | {% endfor %}}
8 | {% endif %}
9 | {%- if link.get_body_field() and not link.get_expanded_body() %}data = ...
10 | {% endif %}
11 | {%- if link.get_body_field() and link.get_expanded_body() %}data = {
12 | {% for key, schema in link.get_expanded_body().items() %} "{{ key }}": ...{% if not loop.last %},{% endif %}
13 | {% endfor %}}
14 | {% endif %}
15 | response = requests.{{ link.method.lower() }}(url{% if link.get_query_fields() %}, params=params{% endif %}{% if link.get_body_field() %}, json=data{% endif %})
16 | response.raise_for_status()
17 | print(response.json())
18 |
19 |
--------------------------------------------------------------------------------
/apistar/themes/apistar/templates/layout/content.html:
--------------------------------------------------------------------------------
1 | {{ document.description }}
5 | {% endif %} 6 |{{ link.description }}
{% endif %} 12 | 13 | {% if link.get_path_fields() %} 14 |The following parameters should be included in the URL path.
16 |Parameter | Description |
---|---|
{{ field.name }} {% if field.required %} required{% endif %} | {% if field.description or field.schema.description %}{{ field.description or field.schema.description }}{% endif %} |
The following parameters should be included as part of a URL query string.
30 |Parameter | Description |
---|---|
{{ field.name }} {% if field.required %} required{% endif %} | {% if field.description or field.schema.description %}{{ field.description or field.schema.description }}{% endif %} |
The request body should be "{{ link.encoding }}"
encoded, and should contain {% if expanded %}an object with the following attributes.{% else %}a single item.{% endif %}
Parameter | Description |
---|---|
{{ key }} {% if key in field.schema.required %} required{% endif %} | {% if schema.description %}{{ schema.description }}{% endif %} |
{{ field.name }} {% if field.required %} required{% endif %} | {% if field.description or field.schema.description %}{{ field.description or field.schema.description }}{% endif %} |
Page not found
9 |
2 |
3 |
5 | 🛠 The Web API toolkit. 🛠 6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |