package python sdk using setuptools

This commit is contained in:
geekerzp
2015-04-09 17:56:49 +08:00
parent 70c14092f9
commit e6bf58a707
17 changed files with 154 additions and 56 deletions

View File

@@ -1,25 +0,0 @@
# Swagger Generated Python client
Usage example, based on the swagger petstore:
```python
# include the client module
from client import *
# build a client connection. In this example, we are passing the hostname as arg0, and
# sending a header with name `api_key` and value `special-key` on each call to the api.
client = swagger.ApiClient('http://petstore.swagger.io/v2', 'api_key', 'special-key')
# create the PetApi class with the client we just created
petApi = PetApi.PetApi(client)
# call the API and fetch a pet, with petId=3
pet = petApi.getPetById(petId=3)
# write it into pretty JSON
json = client.sanitizeForSerialization(pet)
print json
{'category': {'category': None, 'status': None, 'name': 'string', 'tags': None, 'photoUrls': None, 'id': 0L}, 'status': {'category': None, 'status': None, 'name': None, 'tags': None, 'photoUrls': None, 'id': None}, 'name': 'foogly', 'tags': [{'id': 0L, 'name': 'string'}], 'photoUrls': ['string'], 'id': 3L}
```

View File

@@ -0,0 +1,15 @@
## Requirements.
Python 2.7 and later.
## Setuptools
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
python setup.py install
```
Or you can install from Github via pip:
```sh
```

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 Reverb Technologies, Inc.
@@ -41,7 +43,7 @@ class Category(object):
'name': 'name'
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 Reverb Technologies, Inc.
@@ -61,7 +63,7 @@ class Order(object):
'complete': 'complete'
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 Reverb Technologies, Inc.
@@ -61,7 +63,7 @@ class Pet(object):
'status': 'status'
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 Reverb Technologies, Inc.
@@ -41,7 +43,7 @@ class Tag(object):
'name': 'name'
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 Reverb Technologies, Inc.
@@ -71,7 +73,7 @@ class User(object):
'user_status': 'userStatus'
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
PetApi.py
Copyright 2015 Reverb Technologies, Inc.

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
StoreApi.py
Copyright 2015 Reverb Technologies, Inc.

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
"""
UserApi.py
Copyright 2015 Reverb Technologies, Inc.

View File

@@ -0,0 +1,32 @@
import sys
from setuptools import setup, find_packages
# To install the library, open a Terminal shell, then run this
# file by typing:
#
# python setup.py install
#
# You need to have the setuptools module installed.
# Try reading the setuptools documentation:
# http://pypi.python.org/pypi/setuptools
REQUIRES = []
setup(
name="SwaggerPetstore",
version="1.0.0",
description="Swagger Petstore",
author_email="apiteam@wordnik.com",
url="",
keywords=["Swagger", "Swagger Petstore"],
install_requires=REQUIRES,
packages=find_packages(),
include_package_data=True,
long_description="""\
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
"""
)