這是我寫的要使用Python的揚鞭SDK的API調用的代碼:揚鞭的Python的SDK返回無盡管API調用是成功
import swagger_client
client = swagger_client.ApiClient()
response = client.call_api('/student', 'POST')
print(response)
response
爲None
。
這是我寫的要使用Python的揚鞭SDK的API調用的代碼:揚鞭的Python的SDK返回無盡管API調用是成功
import swagger_client
client = swagger_client.ApiClient()
response = client.call_api('/student', 'POST')
print(response)
response
爲None
。
call_api
該方法採用參數response_type
其可具有以下值之一:
int
,str
,bool
等對應於swagger_client.models.*
如果未傳遞此參數,則由0123返回的值將是None
。
在這種情況下:
response = client.call_api('/student', 'POST', response_type = swagger_client.models.Student)
將返回Student
類型的對象和
response = client.call_api('/student', 'POST', response_type = 'str')
將返回字符串。
您不需要直接使用ApiClient
的call_api
方法。您可以改用在* API類(如PetApi)產生的方法:
self.pet_api.add_pet(body=self.pet)
fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id)