Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/python-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python -DpackageName=petstore_api $@"
ags="generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python $@"

# java $JAVA_OPTS -jar $executable $ags
java $JAVA_OPTS -jar $executable $ags
64 changes: 64 additions & 0 deletions samples/client/petstore/python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
venv/
.python-version

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#Ipython Notebook
.ipynb_checkpoints
23 changes: 23 additions & 0 deletions samples/client/petstore/python/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions samples/client/petstore/python/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.14-SNAPSHOT
14 changes: 14 additions & 0 deletions samples/client/petstore/python/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5"
#- "3.5-dev" # 3.5 development branch
#- "nightly" # points to the latest development branch e.g. 3.6-dev
# command to install dependencies
install: "pip install -r requirements.txt"
# command to run tests
script: nosetests
241 changes: 241 additions & 0 deletions samples/client/petstore/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# swagger-client
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

## Requirements.

Python 2.7 and 3.4+

## Installation & Usage
### pip install

If the python package is hosted on Github, you can install directly from Github

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import swagger_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import swagger_client
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.AnimalApi(swagger_client.ApiClient(configuration))
body = swagger_client.Animal() # Animal | Animal object that needs to be added to the store

try:
# Add a new animal to the store
api_instance.add_animal(body)
except ApiException as e:
print("Exception when calling AnimalApi->add_animal: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AnimalApi(swagger_client.ApiClient(configuration))
animal_id = 789 # int | Animal id to delete
api_key = 'api_key_example' # str | (optional)

try:
# Deletes a animal
api_instance.delete_animal(animal_id, api_key=api_key)
except ApiException as e:
print("Exception when calling AnimalApi->delete_animal: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AnimalApi(swagger_client.ApiClient(configuration))
animal_id = 789 # int | ID of pet to return

try:
# Find animal by ID
api_response = api_instance.get_animal_by_id(animal_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnimalApi->get_animal_by_id: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AnimalApi(swagger_client.ApiClient(configuration))
body = swagger_client.Animal() # Animal | Animal object that needs to be added.

try:
# Update an existing animal
api_instance.update_animal(body)
except ApiException as e:
print("Exception when calling AnimalApi->update_animal: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AnimalApi(swagger_client.ApiClient(configuration))
animal_id = 789 # int | ID of animal that needs to be updated
name = 'name_example' # str | (optional)
status = 'status_example' # str | (optional)

try:
# Updates a animal
api_instance.update_animal_with_form(animal_id, name=name, status=status)
except ApiException as e:
print("Exception when calling AnimalApi->update_animal_with_form: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io:80/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnimalApi* | [**add_animal**](docs/AnimalApi.md#add_animal) | **POST** /animal | Add a new animal to the store
*AnimalApi* | [**delete_animal**](docs/AnimalApi.md#delete_animal) | **DELETE** /animal/{animalId} | Deletes a animal
*AnimalApi* | [**get_animal_by_id**](docs/AnimalApi.md#get_animal_by_id) | **GET** /animal/{animalId} | Find animal by ID
*AnimalApi* | [**update_animal**](docs/AnimalApi.md#update_animal) | **PUT** /animal | Update an existing animal
*AnimalApi* | [**update_animal_with_form**](docs/AnimalApi.md#update_animal_with_form) | **POST** /animal/{animalId} | Updates a animal
*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*DogApi* | [**add_dog**](docs/DogApi.md#add_dog) | **POST** /dog | Add a new dog to the store
*DogApi* | [**delete_dog**](docs/DogApi.md#delete_dog) | **DELETE** /dog/{dogId} | Deletes a dog
*DogApi* | [**get_dog_by_id**](docs/DogApi.md#get_dog_by_id) | **GET** /dog/{dogId} | Find dog by ID
*DogApi* | [**update_dog**](docs/DogApi.md#update_dog) | **PUT** /dog | Update an existing dog
*DogApi* | [**update_dog_with_form**](docs/DogApi.md#update_dog_with_form) | **POST** /dog/{dogId} | Updates a dog
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**test_enum_request_body**](docs/FakeApi.md#test_enum_request_body) | **POST** /fake/enum/form | To test enum parameters
*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **POST** /fake/jsonFormData | test json serialization of form data
*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**get_all_pets**](docs/PetApi.md#get_all_pets) | **GET** /allPets |
*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**get_random_pet**](docs/PetApi.md#get_random_pet) | **GET** /randomPet |
*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user

## Documentation For Models

- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [AllPetsResponse](docs/AllPetsResponse.md)
- [Animal](docs/Animal.md)
- [AnimalFarm](docs/AnimalFarm.md)
- [ApiResponse](docs/ApiResponse.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [Body](docs/Body.md)
- [Body1](docs/Body1.md)
- [Body2](docs/Body2.md)
- [Body3](docs/Body3.md)
- [Body4](docs/Body4.md)
- [Body5](docs/Body5.md)
- [Body6](docs/Body6.md)
- [Body7](docs/Body7.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [Dog](docs/Dog.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
- [FormatTest](docs/FormatTest.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [List](docs/List.md)
- [MapTest](docs/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](docs/Model200Response.md)
- [ModelReturn](docs/ModelReturn.md)
- [Name](docs/Name.md)
- [NumberOnly](docs/NumberOnly.md)
- [OneOfAllPetsResponseItems](docs/OneOfAllPetsResponseItems.md)
- [OneOfSinglePetResponsePet](docs/OneOfSinglePetResponsePet.md)
- [Order](docs/Order.md)
- [OuterBoolean](docs/OuterBoolean.md)
- [OuterComposite](docs/OuterComposite.md)
- [OuterEnum](docs/OuterEnum.md)
- [OuterNumber](docs/OuterNumber.md)
- [OuterString](docs/OuterString.md)
- [Pet](docs/Pet.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SinglePetResponse](docs/SinglePetResponse.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)

## Documentation For Authorization


## api_key

- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

## api_key_query

- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string

## http_basic_test

- **Type**: HTTP basic authentication

## petstore_auth

- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- ****:


## Author

[email protected]
10 changes: 10 additions & 0 deletions samples/client/petstore/python/docs/AdditionalPropertiesClass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AdditionalPropertiesClass

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**map_property** | **dict(str, str)** | | [optional]
**map_of_map_property** | **dict(str, dict(str, str))** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

8 changes: 8 additions & 0 deletions samples/client/petstore/python/docs/AllPetsResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# AllPetsResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions samples/client/petstore/python/docs/Animal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Animal

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] [default to 'red']

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Loading