这是一个示例服务器petstore服务器。您可以在[http://savigig.i](http://sAgAj.IO)或[IRC.FieloDe.NET,Saviggiger-](http://savigig.iO/IRC/)上了解更多关于Sigggg的信息。对于这个示例,可以使用API密钥“特殊密钥”来测试授权筛选器。

withnewimplemenation11的Python项目详细描述


#入门

这是一个示例服务器petstore服务器。您可以在[http://swagger.io](http://swagger.io)或[irc.freenode.net,swagger](http://swagger.io/irc/)上了解有关swagger的更多信息。对于此示例,可以使用API密钥"特殊密钥"测试授权筛选器。

此sdk包依赖于其他python包,如nose、jsonpickle等。
这些依赖项在sdk附带的``requirements.txt``文件中定义。
要解决这些依赖项,可以使用pip依赖项管理器。按照[https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/)中的步骤安装它。

python和pip可执行文件应在路径中定义。打开命令提示符并键入``pip--version``.
如果安装成功并正确定义了路径,则应显示安装的pip依赖关系管理器的版本。

*使用命令行,导航到包含生成文件的目录(包括``` requirements.txt``)用于sdk。
*运行命令``pip install-r requirements.txt````。这应该安装所有必需的依赖项。

![构建sdk-步骤1](https://apidocs.io/illustration/python?step=installdependencies&workspacefolder=swagger%20petstore python)



在ide中打开项目

打开python ide,比如pycharm。如果您喜欢使用不同的编辑器或IDE,这里提供的基本工作流也适用。

![在PyCharm中打开项目-步骤1](https://apidocs.io/illustration/python?step=pycharm)

[在PyCharm中打开项目-第2步](https://apidocs.io/illustration/python?step=openproject0&workspacefolder=swagger%20petstore python)


项目文件将显示在侧栏中,如下所示:

![在PyCharm中打开项目-第3步](https://apidocs.io/illustration/python?step=openproject1&workspacefolder=swagger%20petstore python&;projectname=withnewimplementation11)

2。添加一个新的测试项目

右键单击解决方案名称创建一个新目录,如下所示:

![在PyCharm中添加新项目-步骤1](https://apidocs.io/illustration/python?step=createdirectory&workspacefolder=swagger%20petstore python&;projectname=withnewimplementation11)


将目录命名为"test"

![在PyCharm中添加新项目-步骤2](https://apidocs.io/illustration/python?step=nameditory)


将一个名为"testsdk"的python文件添加到此项目中

![在PyCharm中添加新项目-步骤3](https://apidocs.io/illustration/python?step=createfile&workspacefolder=swagger%20petstore python&;projectname=withnewimplementation11)


将其命名为"testsdk"

![在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=namefile)


在python文件中,需要使用以下代码行从withnewimplementation11导入生成的python库

``python
。withnewimplementation11u client import withnewimplementation11client
```

![在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=projectfiles&workspacefolder=swagger%20petstore python&libraryname=withnewimplementation11.withnewimplementation_11_client&projectname=withnewimplementation11&classname=withnewimplementation11 client)

控制器对象并进行API调用。su中给出了示例代码b序列段。

3.运行测试项目

若要在测试项目中运行该文件,请右键单击测试项目中的python文件,然后单击"运行"`

![运行测试项目-步骤1](https://apidocs.io/illustation/python?step=runproject&workspacefolder=swagger%20petstore python&libraryname=withnewimplementation11.withnewimplementation11.withnewimplementation11.withnewimplementation11客户端)




\how to test

自动生成测试
案例。unittest用作测试框架,nose用作测试
运行器。您可以按如下方式运行测试:

1。从terminal/cmd导航到sdk的根目录。
2。调用``pip install-r test requirements.txt``
3。调用``nosetests``

d
o_auth_redirect_uri oauth 2重定向端点或回调uri





``python
_非统2重定向端点或回调uri



>client=withnewimplement11client(o_auth_客户端身份,o_auth_重定向uri)的客户端
`
>






;类参考




;<;a name="list_of_controller">;<;a>;<;a>;控制器列表


>
>>>>



>>>*[商店控制器](商店控制器)
*[用户控制器](用户控制器)

lt;a name="宠物控制器">;<;/a>;![类:](https://apidocs.io/img/class.png.pet controller")petcontroller

>;<;/a>;![方法](https://apiddocs.io/img/method.png.petcontroller.add-pet.pet.pet.petcontroller.add-pet)add-pet


>;将新宠物添加到商店


``python
deadd-pet(self,
```














参数标签标签描述

----------|









35 35 35
`` python
body=pet pet()


35;错误

错误代码错误描述
-----————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————[方法:](https://apiddocs.io/img/method.png.petcontroller.update-pet)update-pet

>;更新现有pet

`` python
———--|---关于`````````````````````````````需要添加到商店的宠物物品`````````````````````需要添加到商店的宠物物品``





````````````````````````````````````````````````````````````````````````````````````````````````````````````````错误

错误代码错误描述
-----————————————[方法:](https://apidocs.io/img/method.png".petcontroller.find_pets_by_status")find_pets_by_status

>;可以为多个状态值提供逗号分隔的字符串

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

#### Parameters

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



#### Example Usage

```python
status = [Status2Enum.AVAILABLE]

result = pet_控制器。按宠物的状态(状态)查找宠物。按宠物的状态(状态)查找宠物


```










5735 5735 5735 \\ \\35 \ \ \35 \35 \35 \\;<;a name="按标签查找宠物">;<;/a>;![方法:](https://apidocs.io/img/method.png".petcontroller.find_pets_by_tags")find_pets_by_tags

>;多个标记可以提供逗号分隔的字符串。Use tag1, tag2, tag3 for testing.

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

#### Parameters

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



#### Example Usage

```python
tags = ['tags']

result = pet_controller.find_pets_by_tags(tags)

```

#### Errors

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




### <a name="get_pet_by_id"></a>![方法:](https://apiddocs.io/img/method.png.petcontroller.get_pet_-pet_-pet_-pet_-pet_-pet_-pet_-pet-by_-id

>;返回单个宠物

`` python
def get_-pet_-pet_-pet_-pet_-pet-by_-id(self,
>pet-id)
``````
>>

//
——————————————————————————————————————————————————————————————————————————————————d ``` | ID of pet to return |



#### Example Usage

```python
pet_id = 212

result = pet_controller.get_pet_by_id(pet_id)

```

#### Errors

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




[方法:](https://apidocs.io/img/method.png).petcontroller.update_pet_with_form")update_pet_with_form

>;使用表单数据更新存储区中的宠物

`` python
def update_pet_with_form(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 = 212
name = 'name'
status = 'status'

pet_controller.update_pet_with_form(pet_id, name, status)

```

#### Errors

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




### <a name="delete_pet"></a>![方法:](https://apiddocs.io/img/method.png.petcontroller.delete-pet)delete-pet

>;删除宠物


聚乙烯tId | ``` Required ``` | Pet id to delete |
| apiKey | ``` Optional ``` | TODO: Add a parameter description |



#### Example Usage

```python
pet_id = 212
api_key = 'api_key'

pet_controller.delete_pet(pet_id, api_key)

```

#### Errors

| Error Code | Error Description |
|—————————————---————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————[方法:](https://apidocs.io/img/method.png".petcontroller.upload戡file")上传戡file

>;上传图像

```python
def upload戡file(self,
pet戡id,
additional戡metadata=none,
file=none)
`````

####参数










``python
pet-u id=212
additional元数据='additional metadata'
file=open("pathttofile","rb")


















[返回控制器列表](《列表》pet list)pet id=212







[返回返回到控制器列表][返回到控制器列表](《列表》控制llers)

\[类:](https://apidocs.io/img/class.png.store controller")storecontroller

="获取库存">;<;/a>;![方法:](https://apidocs.io/img/method.png.store controller.get戡inventory)get戡inventory

>;返回状态代码到数量的映射

``python
``def get戡inventory(self)
````



````



\[方法:](https://apidocs.io/img/method.png.storecontroller.create廑place廑order")创建廑place廑order


>;为宠物下单

``python
def create廑place廑order(self,
````

关于宠物用品的采购订单````````````````````````````````````购买宠物`





>```````````````````````````````````蟒蟒蟒蟒蟒蟒蟒蟒蟒蟒``````````````````````````````````````````````````````````````````````````````````br/>```

|错误代码错误描述
----------
400无效顺序






[方法:](https://apidocs.io/img/method.png".storecontroller.get_order_by_id")get_order_by_id

>;若要获得有效响应,请尝试值为>;=1且<;=10的整数id。其他值则会生成异常


``python
>defeget_order_order_order_order_order_order_order_id(self,
```



35 35


参数标签







<<



```````````需要宠物的身份证取







35 35 35 35 35 35 35 35 \35 \35 \35 \35 35 \\\\35 35 \\\\错误代码"错误描述"无效IED
404找不到订单




lt;a name="delete_u order">;<;/a>;![方法:](https://apidocs.io/img/method.png".storecontroller.delete戋order")delete戋order

>;若要获得有效响应,请尝试使用正整数值的整数ID。负或非整数值或非整数值将产生api错误


```python
>dedededelete_order(self,
order_id)
``







;的ID需要删除的订单








``python
order\u id=212



store\store-controller.delete\order(order\u id)

```



`
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `>404未找到订单







[返回控制器列表](控制器列表)

<;a name="user_controller">;<;/a>;![类:](https://apidocs.io/img/class.png.user controller")usercontroller

"用户">;<;/a>;![方法:](https://apidocs.io/img/method.png.usercontroller.create_user")create_user

>;这只能由登录用户完成。

`` python
def create_user(self,
````

|
|-----------|------|-------------|
| body | ``` Required ``` | Created user object |



#### Example Usage

```python
body = User()

user_controller.create_user(body)

```

#### Errors

| Error Code | Error Description |
|---————————————————————————————————————————————————————————————————————————————————————————————————[方法:](https://apidocs.io/img/method.png".usercontroller.create_users_with_array_input")create_users_with_array_input

>;创建具有给定输入数组的用户列表

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











参数标签;







































35;示例用法

``python
body=[user()]

带有阵列输入(body)的rs-u阵列输入(body)


```


























//lt;a name="create_users_with_list_input">;<;/a>;![方法:](https://apidocs.io/img/method.png".usercontroller.create_users_with_list_input")create_users_with_list_input

>;创建具有给定输入数组的用户列表

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



























;示例用法有无列表输入(body)


````












错误代码错误描述






























>;将用户登录到系统中

`` python
def get戡login戡user(self,
用户名,
```


|参数tags `` python
用户名='用户名'
password='password'

result=user_u controller.get_u login_u user(用户名,密码)

`````

\提供ME/密码






\[方法:](https://apiddocs.io/img/method.png.user controller.get-logout用户登录登录用户获取登录登录用户登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录用户登录登录登录登录登录用户登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录登录登录登录登录登录用户登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录登录用户(登录登录登录登录登录登录登录登录登录登录登录登录ut_user()

````






































```














;说明|
————————————————————————————————————————————————————————————————————————————————————————————需要提取的名称。使用user1进行测试。|







35 35 35 35 35 35 35 35 \35 \35 \35 \ \ \35 \35 35 35 \ \35 \\\\ \35 \\
————————————————————————————————————————————————————————————————————————————————d
404找不到用户





[方法:](https://apidocs.io/img/method.png.usercontroller.update戡user")update戡user

>;这只能由登录的用户完成。

``python
def update戡user(self,
username,
````

|参数标签描述



用户名='用户名'
正文=用户()。




```










\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\>



\t![方法:](https://apidocs.io/img/method.png.usercontroller.delete_user")delete_user

>;这只能由登录的用户完成。

`` python
` def delete_user(self,
`用户名)
````

参数描述n
------------------










` ``

ode错误描述
----------
400提供的用户名无效
404找不到用户





[返回控制器列表](控制器列表)







欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Java中使用Kotlin值类   在Hadoop中表示大文本块作为键的java   java安卓工作室;布局设计视图;   字典Java确定字符串是否以映射中的键开头   JavaG1:混合gc和完全gc之间有什么区别?   java Camunda升级组织。阿帕奇。平民语言错误   java Scanner类具有NextLine无限循环   安卓 GCM Java服务器:发送带有重音字符的消息   java我正在构建一个兴趣计算应用程序,我的项目构建良好,有1个警告,但它不会在我的设备上打开   java在Tilera TileGX上构建OpenJDK 8   GUI中的java惰性初始化与急切初始化   java JodaTime四舍五入到最近的一刻钟   java如何限制菜单。SpringRoo中的jspx可以避免对其他用户的实体执行CRUD操作   java我应该将缓冲流链接到输入流,还是在将声音库作为嵌入式资源加载时使用URL类?