Last active
December 20, 2018 12:19
-
-
Save kakwa/0d192ee6f354b305cbfa931a20133fac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_statement | |
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.DefaultApi() | |
body = # Pet | | |
try: | |
api_instance.pets_post(body) | |
except ApiException as e: | |
print("Exception when calling DefaultApi->petsPost: %s\n" % e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
swagger: "2.0" | |
info: | |
version: "1.0.0" | |
title: "Swagger Petstore" | |
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification" | |
termsOfService: "http://swagger.io/terms/" | |
contact: | |
name: "Swagger API Team" | |
license: | |
name: "MIT" | |
host: "petstore.swagger.io" | |
basePath: "/api" | |
schemes: | |
- "http" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
paths: | |
/pets: | |
post: | |
description: "Create a pet" | |
responses: | |
"200": | |
description: "Pet created" | |
parameters: | |
- in: body | |
name: body | |
required: true | |
schema: | |
$ref: '#/definitions/Pet' | |
definitions: | |
Pet: | |
type: "object" | |
required: | |
- "id" | |
- "name" | |
properties: | |
id: | |
type: "integer" | |
format: "int64" | |
example: 42 | |
name: | |
type: "string" | |
example: 'Georges' | |
tag: | |
type: "string" | |
example: "dog" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment