added readme, rebuilt client

This commit is contained in:
Tony Tam
2015-02-15 19:50:23 -08:00
parent 719820c089
commit e943f5c864
8 changed files with 259 additions and 210 deletions

View File

@@ -62,6 +62,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("date", "datetime");
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("swagger.mustache", module, "swagger.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", module, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", modelPackage.replaceAll("\\.", File.separator), "__init__.py"));

View File

@@ -0,0 +1,25 @@
# 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}
```