Update python sample code.

This commit is contained in:
geekerzp 2015-04-03 18:21:33 +08:00
parent d4ac668cd4
commit b4d4fa1a43
2 changed files with 14 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class PetApi(object):
bodyParam = None
headerParams['Accept'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'application/json,application/xml,'
@ -119,7 +119,7 @@ class PetApi(object):
bodyParam = None
headerParams['Accept'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'application/json,application/xml,'
@ -370,7 +370,7 @@ class PetApi(object):
bodyParam = None
headerParams['Accept'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'application/x-www-form-urlencoded'
headerParams['Content-Type'] = 'application/x-www-form-urlencoded,'
@ -506,7 +506,7 @@ class PetApi(object):
bodyParam = None
headerParams['Accept'] = 'application/json,application/xml'
headerParams['Content-Type'] = 'multipart/form-data'
headerParams['Content-Type'] = 'multipart/form-data,'

View File

@ -34,6 +34,16 @@ class ApiClient(object):
self.host = host
self.cookie = None
self.boundary = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(30))
# Set default User-Agent.
self.user_agent = 'Python-Swagger'
@property
def user_agent(self):
return self.defaultHeaders['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.defaultHeaders['User-Agent'] = value
def setDefaultHeader(self, headerName, headerValue):
self.defaultHeaders[headerName] = headerValue