Skip to content

Commit a7c08e6

Browse files
committed
update python samples
1 parent 2251a2f commit a7c08e6

File tree

18 files changed

+126
-48
lines changed

18 files changed

+126
-48
lines changed
3.83 KB
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Collecting nose (from -r dev-requirements.txt (line 1))
2+
Using cached nose-1.3.7-py2-none-any.whl
3+
Collecting tox (from -r dev-requirements.txt (line 2))
4+
Using cached tox-2.1.1-py2.py3-none-any.whl
5+
Collecting coverage (from -r dev-requirements.txt (line 3))
6+
Collecting randomize (from -r dev-requirements.txt (line 4))
7+
Using cached randomize-0.13-py2.py3-none-any.whl
8+
Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2))
9+
Using cached virtualenv-13.1.2-py2.py3-none-any.whl
10+
Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2))
11+
Using cached py-1.4.30-py2.py3-none-any.whl
12+
Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2))
13+
Using cached pluggy-0.3.0-py2.py3-none-any.whl
14+
Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize
15+
Successfully installed coverage-3.7.1 nose-1.3.7 pluggy-0.3.0 py-1.4.30 randomize-0.13 tox-2.1.1 virtualenv-13.1.2

samples/client/petstore/python/setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88

99

1010

11-
# To install the library, open a Terminal shell, then run this
12-
# file by typing:
11+
# To install the library, run the following
1312
#
1413
# python setup.py install
1514
#
16-
# You need to have the setuptools module installed.
17-
# Try reading the setuptools documentation:
15+
# prerequisite: setuptools
1816
# http://pypi.python.org/pypi/setuptools
1917

2018
REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Metadata-Version: 1.0
2+
Name: swagger-client
3+
Version: 1.0.0
4+
Summary: Swagger Petstore
5+
Home-page: UNKNOWN
6+
Author: UNKNOWN
7+
Author-email: [email protected]
8+
License: UNKNOWN
9+
Description: This is a sample server Petstore server. You can find out more about Swagger at &lt;a href=\&quot;http://swagger.io\&quot;&gt;http://swagger.io&lt;/a&gt; or on irc.freenode.net, #swagger. For this sample, you can use the api key \&quot;special-key\&quot; to test the authorization filters
10+
11+
Keywords: Swagger,Swagger Petstore
12+
Platform: UNKNOWN
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
setup.cfg
2+
setup.py
3+
swagger_client/__init__.py
4+
swagger_client/api_client.py
5+
swagger_client/configuration.py
6+
swagger_client/rest.py
7+
swagger_client.egg-info/PKG-INFO
8+
swagger_client.egg-info/SOURCES.txt
9+
swagger_client.egg-info/dependency_links.txt
10+
swagger_client.egg-info/requires.txt
11+
swagger_client.egg-info/top_level.txt
12+
swagger_client/apis/__init__.py
13+
swagger_client/apis/pet_api.py
14+
swagger_client/apis/store_api.py
15+
swagger_client/apis/user_api.py
16+
swagger_client/models/__init__.py
17+
swagger_client/models/category.py
18+
swagger_client/models/order.py
19+
swagger_client/models/pet.py
20+
swagger_client/models/tag.py
21+
swagger_client/models/user.py
22+
tests/__init__.py
23+
tests/test_api_client.py
24+
tests/test_api_exception.py
25+
tests/test_deserialization.py
26+
tests/test_order_model.py
27+
tests/test_pet_api.py
28+
tests/test_pet_model.py
29+
tests/test_store_api.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
urllib3 >= 1.10
2+
six >= 1.9
3+
certifi
4+
python-dateutil
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
swagger_client
2+
tests

samples/client/petstore/python/swagger_client/api_client.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
See the License for the specific language governing permissions and
1616
limitations under the License.
17+
18+
ref: https://github.com/swagger-api/swagger-codegen
1719
"""
1820

1921
from __future__ import absolute_import
@@ -56,7 +58,7 @@ class ApiClient(object):
5658
templates.
5759
5860
NOTE: This class is auto generated by the swagger code generator program.
59-
https://github.com/swagger-api/swagger-codegen
61+
Ref: https://github.com/swagger-api/swagger-codegen
6062
Do not edit the class manually.
6163
6264
:param host: The base path for the server to call.
@@ -75,7 +77,7 @@ def __init__(self, host=Configuration().host,
7577
self.host = host
7678
self.cookie = cookie
7779
# Set default User-Agent.
78-
self.user_agent = 'Python-Swagger'
80+
self.user_agent = 'Python-Swagger/1.0.0'
7981

8082
@property
8183
def user_agent(self):
@@ -280,7 +282,8 @@ def call_api(self, resource_path, method,
280282
body=None, post_params=None, files=None,
281283
response_type=None, auth_settings=None, callback=None):
282284
"""
283-
Makes the HTTP request and return the deserialized data.
285+
Makes the HTTP request (synchronous) and return the deserialized data.
286+
To make an async request, define a function for callback.
284287
285288
:param resource_path: Path to method endpoint.
286289
:param method: Method to call.
@@ -450,9 +453,8 @@ def update_params_for_auth(self, headers, querys, auth_settings):
450453

451454
def __deserialize_file(self, response):
452455
"""
453-
Saves response body into a file in (the defined) temporary folder,
454-
using the filename from the `Content-Disposition` header if provided,
455-
otherwise a random filename.
456+
Saves response body into a file in a temporary folder,
457+
using the filename from the `Content-Disposition` header if provided.
456458
457459
:param response: RESTResponse.
458460
:return: file path.

samples/client/petstore/python/swagger_client/apis/pet_api.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PetApi(object):
3333
"""
3434
NOTE: This class is auto generated by the swagger code generator program.
3535
Do not edit the class manually.
36+
Ref: https://github.com/swagger-api/swagger-codegen
3637
"""
3738

3839
def __init__(self, api_client=None):
@@ -49,7 +50,7 @@ def update_pet(self, **kwargs):
4950
Update an existing pet
5051
5152
52-
This method makes a synchronous HTTP request by default.To make an
53+
This method makes a synchronous HTTP request by default. To make an
5354
asynchronous HTTP request, please define a `callback` function
5455
to be invoked when receiving the response.
5556
>>> def callback_function(response):
@@ -124,7 +125,7 @@ def add_pet(self, **kwargs):
124125
Add a new pet to the store
125126
126127
127-
This method makes a synchronous HTTP request by default.To make an
128+
This method makes a synchronous HTTP request by default. To make an
128129
asynchronous HTTP request, please define a `callback` function
129130
to be invoked when receiving the response.
130131
>>> def callback_function(response):
@@ -199,7 +200,7 @@ def find_pets_by_status(self, **kwargs):
199200
Finds Pets by status
200201
Multiple status values can be provided with comma seperated strings
201202
202-
This method makes a synchronous HTTP request by default.To make an
203+
This method makes a synchronous HTTP request by default. To make an
203204
asynchronous HTTP request, please define a `callback` function
204205
to be invoked when receiving the response.
205206
>>> def callback_function(response):
@@ -274,7 +275,7 @@ def find_pets_by_tags(self, **kwargs):
274275
Finds Pets by tags
275276
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
276277
277-
This method makes a synchronous HTTP request by default.To make an
278+
This method makes a synchronous HTTP request by default. To make an
278279
asynchronous HTTP request, please define a `callback` function
279280
to be invoked when receiving the response.
280281
>>> def callback_function(response):
@@ -349,7 +350,7 @@ def get_pet_by_id(self, pet_id, **kwargs):
349350
Find pet by ID
350351
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
351352
352-
This method makes a synchronous HTTP request by default.To make an
353+
This method makes a synchronous HTTP request by default. To make an
353354
asynchronous HTTP request, please define a `callback` function
354355
to be invoked when receiving the response.
355356
>>> def callback_function(response):
@@ -427,7 +428,7 @@ def update_pet_with_form(self, pet_id, **kwargs):
427428
Updates a pet in the store with form data
428429
429430
430-
This method makes a synchronous HTTP request by default.To make an
431+
This method makes a synchronous HTTP request by default. To make an
431432
asynchronous HTTP request, please define a `callback` function
432433
to be invoked when receiving the response.
433434
>>> def callback_function(response):
@@ -511,7 +512,7 @@ def delete_pet(self, pet_id, **kwargs):
511512
Deletes a pet
512513
513514
514-
This method makes a synchronous HTTP request by default.To make an
515+
This method makes a synchronous HTTP request by default. To make an
515516
asynchronous HTTP request, please define a `callback` function
516517
to be invoked when receiving the response.
517518
>>> def callback_function(response):
@@ -592,7 +593,7 @@ def upload_file(self, pet_id, **kwargs):
592593
uploads an image
593594
594595
595-
This method makes a synchronous HTTP request by default.To make an
596+
This method makes a synchronous HTTP request by default. To make an
596597
asynchronous HTTP request, please define a `callback` function
597598
to be invoked when receiving the response.
598599
>>> def callback_function(response):

0 commit comments

Comments
 (0)