|
| 1 | +# {{packageName}} |
| 2 | +{{#appDescription}} |
| 3 | +{{{appDescription}}} |
| 4 | +{{/appDescription}} |
| 5 | + |
| 6 | +This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: |
| 7 | + |
| 8 | +- API version: {{appVersion}} |
| 9 | +- Package version: {{packageVersion}} |
| 10 | +- Build date: {{generatedDate}} |
| 11 | +- Build package: {{generatorClass}} |
| 12 | +{{#infoUrl}} |
| 13 | +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) |
| 14 | +{{/infoUrl}} |
| 15 | + |
1 | 16 | ## Requirements.
|
2 |
| -Python 2.7 and later. |
3 | 17 |
|
4 |
| -## Setuptools |
5 |
| -You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools). |
| 18 | +Python 2.7 and 3.4+ |
| 19 | + |
| 20 | +## Installation & Usage |
| 21 | +### pip install |
| 22 | + |
| 23 | +If the python package is hosted on Github, you can install directly from Github |
6 | 24 |
|
7 | 25 | ```sh
|
8 |
| -python setup.py install |
| 26 | +pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git |
9 | 27 | ```
|
| 28 | +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git`) |
10 | 29 |
|
11 |
| -Or you can install from Github via pip: |
| 30 | +Then import the package: |
| 31 | +```python |
| 32 | +import {{{packageName}}} |
| 33 | +``` |
| 34 | + |
| 35 | +### Setuptools |
| 36 | + |
| 37 | +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). |
12 | 38 |
|
13 | 39 | ```sh
|
14 |
| -pip install git+https://github.com/geekerzp/swagger_client.git |
| 40 | +python setup.py install --user |
15 | 41 | ```
|
| 42 | +(or `sudo python setup.py install` to install the package for all users) |
16 | 43 |
|
17 |
| -To use the bindings, import the pacakge: |
18 |
| - |
| 44 | +Then import the package: |
19 | 45 | ```python
|
20 |
| -import swagger_client |
| 46 | +import {{{packageName}}} |
21 | 47 | ```
|
22 | 48 |
|
23 |
| -## Manual Installation |
24 |
| -If you do not wish to use setuptools, you can download the latest release. |
25 |
| -Then, to use the bindings, import the package: |
| 49 | +## Getting Started |
| 50 | + |
| 51 | +Please follow the [installation procedure](#installation--usage) and then run the following: |
26 | 52 |
|
27 | 53 | ```python
|
28 |
| -import path.to.swagger_client |
| 54 | +import time |
| 55 | +import {{{packageName}}} |
| 56 | +from {{{packageName}}}.rest import ApiException |
| 57 | +from pprint import pprint |
| 58 | +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} |
| 59 | +# Configure HTTP basic authorization: {{{name}}} |
| 60 | +{{{packageName}}}.configuration.username = 'YOUR_USERNAME' |
| 61 | +{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} |
| 62 | +# Configure API key authorization: {{{name}}} |
| 63 | +{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' |
| 64 | +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed |
| 65 | +# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}} |
| 66 | +# Configure OAuth2 access token for authorization: {{{name}}} |
| 67 | +{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} |
| 68 | +{{/hasAuthMethods}} |
| 69 | +# create an instance of the API class |
| 70 | +api_instance = {{{packageName}}}.{{{classname}}} |
| 71 | +{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} |
| 72 | +{{/allParams}} |
| 73 | + |
| 74 | +try: |
| 75 | +{{#summary}} # {{{.}}} |
| 76 | +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} |
| 77 | + pprint(api_response){{/returnType}} |
| 78 | +except ApiException as e: |
| 79 | + print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e |
| 80 | +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} |
29 | 81 | ```
|
30 | 82 |
|
31 |
| -## Getting Started |
| 83 | +## Documentation for API Endpoints |
32 | 84 |
|
33 |
| -TODO |
| 85 | +All URIs are relative to *{{basePath}}* |
34 | 86 |
|
35 |
| -## Documentation |
| 87 | +Class | Method | HTTP request | Description |
| 88 | +------------ | ------------- | ------------- | ------------- |
| 89 | +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} |
| 90 | +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} |
36 | 91 |
|
37 |
| -TODO |
| 92 | +## Documentation For Models |
38 | 93 |
|
39 |
| -## Tests |
| 94 | +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) |
| 95 | +{{/model}}{{/models}} |
40 | 96 |
|
41 |
| -(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed) |
| 97 | +## Documentation For Authorization |
42 | 98 |
|
43 |
| - Execute the following command to run the tests in the current Python (v2 or v3) environment: |
| 99 | +{{^authMethods}} All endpoints do not require authorization. |
| 100 | +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} |
| 101 | +{{#authMethods}}## {{{name}}} |
44 | 102 |
|
45 |
| -```sh |
46 |
| -$ make test |
47 |
| -[... magically installs dependencies and runs tests on your virtualenv] |
48 |
| -Ran 7 tests in 19.289s |
| 103 | +{{#isApiKey}}- **Type**: API key |
| 104 | +- **API key parameter name**: {{{keyParamName}}} |
| 105 | +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} |
| 106 | +{{/isApiKey}} |
| 107 | +{{#isBasic}}- **Type**: HTTP basic authentication |
| 108 | +{{/isBasic}} |
| 109 | +{{#isOAuth}}- **Type**: OAuth |
| 110 | +- **Flow**: {{{flow}}} |
| 111 | +- **Authorizatoin URL**: {{{authorizationUrl}}} |
| 112 | +- **Scopes**: {{^scopes}}N/A{{/scopes}} |
| 113 | +{{#scopes}} - **{{{scope}}}**: {{{description}}} |
| 114 | +{{/scopes}} |
| 115 | +{{/isOAuth}} |
49 | 116 |
|
50 |
| -OK |
51 |
| -``` |
52 |
| -or |
| 117 | +{{/authMethods}} |
53 | 118 |
|
54 |
| -``` |
55 |
| -$ mvn integration-test -rf :PythonPetstoreClientTests |
56 |
| -Using 2195432783 as seed |
57 |
| -[INFO] ------------------------------------------------------------------------ |
58 |
| -[INFO] BUILD SUCCESS |
59 |
| -[INFO] ------------------------------------------------------------------------ |
60 |
| -[INFO] Total time: 37.594 s |
61 |
| -[INFO] Finished at: 2015-05-16T18:00:35+08:00 |
62 |
| -[INFO] Final Memory: 11M/156M |
63 |
| -[INFO] ------------------------------------------------------------------------ |
64 |
| -``` |
65 |
| -If you want to run the tests in all the python platforms: |
| 119 | +## Author |
66 | 120 |
|
67 |
| -```sh |
68 |
| -$ make test-all |
69 |
| -[... tox creates a virtualenv for every platform and runs tests inside of each] |
70 |
| - py27: commands succeeded |
71 |
| - py34: commands succeeded |
72 |
| - congratulations :) |
73 |
| -``` |
| 121 | +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} |
| 122 | +{{/hasMore}}{{/apis}}{{/apiInfo}} |
0 commit comments