Skip to main content

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.

Project description

# Getting started

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.

## How to Build


You must have Python ```2 >=2.7.9``` or Python ```3 >=3.4``` installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc.
These dependencies are defined in the ```requirements.txt``` file that comes with the SDK.
To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps at [https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/).

Python and PIP executables should be defined in your PATH. Open command prompt and type ```pip --version```.
This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.

* Using command line, navigate to the directory containing the generated files (including ```requirements.txt```) for the SDK.
* Run the command ```pip install -r requirements.txt```. This should install all the required dependencies.

![Building SDK - Step 1](https://apidocs.io/illustration/python?step=installDependencies&workspaceFolder=Swagger%20Petstore-Python)


## How to Use

The following section explains how to use the Swaggerpetstore SDK package in a new project.

### 1. Open Project in an IDE

Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

![Open project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=pyCharm)

Click on ```Open``` in PyCharm to browse to your generated SDK directory and then click ```OK```.

![Open project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=openProject0&workspaceFolder=Swagger%20Petstore-Python)

The project files will be displayed in the side bar as follows:

![Open project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=openProject1&workspaceFolder=Swagger%20Petstore-Python&projectName=stupidpackage)

### 2. Add a new Test Project

Create a new directory by right clicking on the solution name as shown below:

![Add a new project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=createDirectory&workspaceFolder=Swagger%20Petstore-Python&projectName=stupidpackage)

Name the directory as "test"

![Add a new project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=nameDirectory)

Add a python file to this project with the name "testsdk"

![Add a new project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=createFile&workspaceFolder=Swagger%20Petstore-Python&projectName=stupidpackage)

Name it "testsdk"

![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=nameFile)

In your python file you will be required to import the generated python library using the following code lines

```Python
from stupidpackage.stupidpackage_client import StupidpackageClient
```

![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=projectFiles&workspaceFolder=Swagger%20Petstore-Python&libraryName=stupidpackage.stupidpackage_client&projectName=stupidpackage&className=StupidpackageClient)

After this you can write code to instantiate an API client object, get a controller object and make API calls. Sample code is given in the subsequent sections.

### 3. Run the Test Project

To run the file within your test project, right click on your Python file inside your Test project and click on ```Run```

![Run Test Project - Step 1](https://apidocs.io/illustration/python?step=runProject&workspaceFolder=Swagger%20Petstore-Python&libraryName=stupidpackage.stupidpackage_client&projectName=stupidpackage&className=StupidpackageClient)


## How to Test

You can test the generated SDK and the server with automatically generated test
cases. unittest is used as the testing framework and nose is used as the test
runner. You can run the tests as follows:

1. From terminal/cmd navigate to the root directory of the SDK.
2. Invoke ```pip install -r test-requirements.txt```
3. Invoke ```nosetests```

## Initialization

### Authentication
In order to setup authentication and initialization of the API client, you need the following information.

| Parameter | Description |
|-----------|-------------|
| o_auth_client_id | OAuth 2 Client ID |
| o_auth_redirect_uri | OAuth 2 Redirection endpoint or Callback Uri |



API client can be initialized as following.

```python
# Configuration parameters and credentials
o_auth_client_id = 'o_auth_client_id' # OAuth 2 Client ID
o_auth_redirect_uri = 'o_auth_redirect_uri' # OAuth 2 Redirection endpoint or Callback Uri

client = StupidpackageClient(o_auth_client_id, o_auth_redirect_uri)
```



# Class Reference

## <a name="list_of_controllers"></a>List of Controllers

* [PetController](#pet_controller)
* [StoreController](#store_controller)
* [UserController](#user_controller)

## <a name="pet_controller"></a>![Class: ](https://apidocs.io/img/class.png ".PetController") PetController

### Get controller instance

An instance of the ``` PetController ``` class can be accessed from the API Client.

```python
pet_controller = client.pet
```

### <a name="update_pet_put"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.update_pet_put") update_pet_put

> Update an existing pet

```python
def update_pet_put(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` | Pet object that needs to be added to the store |



#### Example Usage

```python
body = Pet()

pet_controller.update_pet_put(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid ID supplied |
| 404 | Pet not found |
| 405 | Validation exception |




### <a name="create_pet_post"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.create_pet_post") create_pet_post

> Add a new pet to the store

```python
def create_pet_post(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` | Pet object that needs to be added to the store |



#### Example Usage

```python
body = Pet()

pet_controller.create_pet_post(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 405 | Invalid input |




### <a name="get_pet_find_by_status_get"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.get_pet_find_by_status_get") get_pet_find_by_status_get

> Multiple status values can be provided with comma separated strings

```python
def get_pet_find_by_status_get(self,
status)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| status | ``` Required ``` ``` Collection ``` | Status values that need to be considered for filter |



#### Example Usage

```python
status = [Status6Enum.AVAILABLE]

result = pet_controller.get_pet_find_by_status_get(status)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid status value |




### <a name="get_pet_find_by_tags_get"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.get_pet_find_by_tags_get") get_pet_find_by_tags_get

> Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

```python
def get_pet_find_by_tags_get(self,
tags)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| tags | ``` Required ``` ``` Collection ``` | Tags to filter by |



#### Example Usage

```python
tags = ['tags']

result = pet_controller.get_pet_find_by_tags_get(tags)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid tag value |




### <a name="get_pet_by_pet_id_get"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.get_pet_by_pet_id_get") get_pet_by_pet_id_get

> Returns a single pet

```python
def get_pet_by_pet_id_get(self,
pet_id)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| petId | ``` Required ``` | ID of pet to return |



#### Example Usage

```python
pet_id = 182

result = pet_controller.get_pet_by_pet_id_get(pet_id)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid ID supplied |
| 404 | Pet not found |




### <a name="create_pet_by_pet_id_post"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.create_pet_by_pet_id_post") create_pet_by_pet_id_post

> Updates a pet in the store with form data

```python
def create_pet_by_pet_id_post(self,
pet_id,
name=None,
status=None)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| petId | ``` Required ``` | ID of pet that needs to be updated |
| name | ``` Optional ``` | Updated name of the pet |
| status | ``` Optional ``` | Updated status of the pet |



#### Example Usage

```python
pet_id = 182
name = 'name'
status = 'status'

pet_controller.create_pet_by_pet_id_post(pet_id, name, status)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 405 | Invalid input |




### <a name="delete_pet_by_pet_id_delete"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.delete_pet_by_pet_id_delete") delete_pet_by_pet_id_delete

> Deletes a pet

```python
def delete_pet_by_pet_id_delete(self,
pet_id,
api_key=None)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| petId | ``` Required ``` | Pet id to delete |
| apiKey | ``` Optional ``` | TODO: Add a parameter description |



#### Example Usage

```python
pet_id = 182
api_key = 'api_key'

pet_controller.delete_pet_by_pet_id_delete(pet_id, api_key)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid ID supplied |
| 404 | Pet not found |




### <a name="create_pet_upload_image_by_pet_id_post"></a>![Method: ](https://apidocs.io/img/method.png ".PetController.create_pet_upload_image_by_pet_id_post") create_pet_upload_image_by_pet_id_post

> uploads an image

```python
def create_pet_upload_image_by_pet_id_post(self,
pet_id,
additional_metadata=None,
file=None)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| petId | ``` Required ``` | ID of pet to update |
| additionalMetadata | ``` Optional ``` | Additional data to pass to server |
| file | ``` Optional ``` | file to upload |



#### Example Usage

```python
pet_id = 182
additional_metadata = 'additionalMetadata'
file = open("pathtofile", 'rb')

result = pet_controller.create_pet_upload_image_by_pet_id_post(pet_id, additional_metadata, file)

```


[Back to List of Controllers](#list_of_controllers)

## <a name="store_controller"></a>![Class: ](https://apidocs.io/img/class.png ".StoreController") StoreController

### Get controller instance

An instance of the ``` StoreController ``` class can be accessed from the API Client.

```python
store_controller = client.store
```

### <a name="get_store_inventory_get"></a>![Method: ](https://apidocs.io/img/method.png ".StoreController.get_store_inventory_get") get_store_inventory_get

> Returns a map of status codes to quantities

```python
def get_store_inventory_get(self)
```

#### Example Usage

```python

result = store_controller.get_store_inventory_get()

```


### <a name="create_store_order_post"></a>![Method: ](https://apidocs.io/img/method.png ".StoreController.create_store_order_post") create_store_order_post

> *Tags:* ``` Skips Authentication ```

> Place an order for a pet

```python
def create_store_order_post(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` | order placed for purchasing the pet |



#### Example Usage

```python
body = Order()

result = store_controller.create_store_order_post(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid Order |




### <a name="get_store_order_by_order_id_get"></a>![Method: ](https://apidocs.io/img/method.png ".StoreController.get_store_order_by_order_id_get") get_store_order_by_order_id_get

> *Tags:* ``` Skips Authentication ```

> For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions

```python
def get_store_order_by_order_id_get(self,
order_id)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| orderId | ``` Required ``` | ID of pet that needs to be fetched |



#### Example Usage

```python
order_id = 182

result = store_controller.get_store_order_by_order_id_get(order_id)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid ID supplied |
| 404 | Order not found |




### <a name="delete_store_order_by_order_id_delete"></a>![Method: ](https://apidocs.io/img/method.png ".StoreController.delete_store_order_by_order_id_delete") delete_store_order_by_order_id_delete

> *Tags:* ``` Skips Authentication ```

> For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors

```python
def delete_store_order_by_order_id_delete(self,
order_id)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| orderId | ``` Required ``` | ID of the order that needs to be deleted |



#### Example Usage

```python
order_id = 19

store_controller.delete_store_order_by_order_id_delete(order_id)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid ID supplied |
| 404 | Order not found |




[Back to List of Controllers](#list_of_controllers)

## <a name="user_controller"></a>![Class: ](https://apidocs.io/img/class.png ".UserController") UserController

### Get controller instance

An instance of the ``` UserController ``` class can be accessed from the API Client.

```python
user_controller = client.user
```

### <a name="create_user_post"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.create_user_post") create_user_post

> *Tags:* ``` Skips Authentication ```

> This can only be done by the logged in user.

```python
def create_user_post(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` | Created user object |



#### Example Usage

```python
body = User()

user_controller.create_user_post(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 0 | successful operation |




### <a name="create_user_create_with_array_post"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.create_user_create_with_array_post") create_user_create_with_array_post

> *Tags:* ``` Skips Authentication ```

> Creates list of users with given input array

```python
def create_user_create_with_array_post(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` ``` Collection ``` | List of user object |



#### Example Usage

```python
body = [User()]

user_controller.create_user_create_with_array_post(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 0 | successful operation |




### <a name="create_user_create_with_list_post"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.create_user_create_with_list_post") create_user_create_with_list_post

> *Tags:* ``` Skips Authentication ```

> Creates list of users with given input array

```python
def create_user_create_with_list_post(self,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| body | ``` Required ``` ``` Collection ``` | List of user object |



#### Example Usage

```python
body = [User()]

user_controller.create_user_create_with_list_post(body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 0 | successful operation |




### <a name="get_user_login_get"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.get_user_login_get") get_user_login_get

> *Tags:* ``` Skips Authentication ```

> Logs user into the system

```python
def get_user_login_get(self,
username,
password)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| username | ``` Required ``` | The user name for login |
| password | ``` Required ``` | The password for login in clear text |



#### Example Usage

```python
username = 'username'
password = 'password'

result = user_controller.get_user_login_get(username, password)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid username/password supplied |




### <a name="get_user_logout_get"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.get_user_logout_get") get_user_logout_get

> *Tags:* ``` Skips Authentication ```

> Logs out current logged in user session

```python
def get_user_logout_get(self)
```

#### Example Usage

```python

user_controller.get_user_logout_get()

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 0 | successful operation |




### <a name="get_user_by_username_get"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.get_user_by_username_get") get_user_by_username_get

> *Tags:* ``` Skips Authentication ```

> Get user by user name

```python
def get_user_by_username_get(self,
username)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| username | ``` Required ``` | The name that needs to be fetched. Use user1 for testing. |



#### Example Usage

```python
username = 'username'

result = user_controller.get_user_by_username_get(username)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid username supplied |
| 404 | User not found |




### <a name="update_user_by_username_put"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.update_user_by_username_put") update_user_by_username_put

> *Tags:* ``` Skips Authentication ```

> This can only be done by the logged in user.

```python
def update_user_by_username_put(self,
username,
body)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| username | ``` Required ``` | name that need to be updated |
| body | ``` Required ``` | Updated user object |



#### Example Usage

```python
username = 'username'
body = User()

user_controller.update_user_by_username_put(username, body)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid user supplied |
| 404 | User not found |




### <a name="delete_user_by_username_delete"></a>![Method: ](https://apidocs.io/img/method.png ".UserController.delete_user_by_username_delete") delete_user_by_username_delete

> *Tags:* ``` Skips Authentication ```

> This can only be done by the logged in user.

```python
def delete_user_by_username_delete(self,
username)
```

#### Parameters

| Parameter | Tags | Description |
|-----------|------|-------------|
| username | ``` Required ``` | The name that needs to be deleted |



#### Example Usage

```python
username = 'username'

user_controller.delete_user_by_username_delete(username)

```

#### Errors

| Error Code | Error Description |
|------------|-------------------|
| 400 | Invalid username supplied |
| 404 | User not found |




[Back to List of Controllers](#list_of_controllers)



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stupidpackage-2-0.tar.gz (21.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page