Skip to content

Commit b4d4fa1

Browse files
committed
Update python sample code.
1 parent d4ac668 commit b4d4fa1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

samples/client/petstore/python/client/PetApi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def updatePet(self, **kwargs):
6363
bodyParam = None
6464

6565
headerParams['Accept'] = 'application/json,application/xml'
66-
headerParams['Content-Type'] = 'application/json,application/xml'
66+
headerParams['Content-Type'] = 'application/json,application/xml,'
6767

6868

6969

@@ -119,7 +119,7 @@ def addPet(self, **kwargs):
119119
bodyParam = None
120120

121121
headerParams['Accept'] = 'application/json,application/xml'
122-
headerParams['Content-Type'] = 'application/json,application/xml'
122+
headerParams['Content-Type'] = 'application/json,application/xml,'
123123

124124

125125

@@ -370,7 +370,7 @@ def updatePetWithForm(self, **kwargs):
370370
bodyParam = None
371371

372372
headerParams['Accept'] = 'application/json,application/xml'
373-
headerParams['Content-Type'] = 'application/x-www-form-urlencoded'
373+
headerParams['Content-Type'] = 'application/x-www-form-urlencoded,'
374374

375375

376376

@@ -506,7 +506,7 @@ def uploadFile(self, **kwargs):
506506
bodyParam = None
507507

508508
headerParams['Accept'] = 'application/json,application/xml'
509-
headerParams['Content-Type'] = 'multipart/form-data'
509+
headerParams['Content-Type'] = 'multipart/form-data,'
510510

511511

512512

samples/client/petstore/python/client/swagger.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ def __init__(self, host=None, headerName=None, headerValue=None):
3434
self.host = host
3535
self.cookie = None
3636
self.boundary = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(30))
37+
# Set default User-Agent.
38+
self.user_agent = 'Python-Swagger'
39+
40+
@property
41+
def user_agent(self):
42+
return self.defaultHeaders['User-Agent']
43+
44+
@user_agent.setter
45+
def user_agent(self, value):
46+
self.defaultHeaders['User-Agent'] = value
3747

3848
def setDefaultHeader(self, headerName, headerValue):
3949
self.defaultHeaders[headerName] = headerValue

0 commit comments

Comments
 (0)