[Python] remove singleton (#5012)

* updated tests relying on configuration's singleton

* regenerated samples

* removed singleton from templates

* regenerated samples

* removed broken sample and its test

* reverted accidental change

* regenerated security/ samples

* removed singleton from RESTClientObject

* removed unused Configuration import

* reverted unrelated change

* updated usage examples in api_doc template
This commit is contained in:
baartosz
2017-03-22 14:25:46 +00:00
committed by wing328
parent bea9e265e9
commit 8b891be7d7
30 changed files with 171 additions and 298 deletions

View File

@@ -73,11 +73,12 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: http_basic_test
petstore_api.configuration.username = 'YOUR_USERNAME'
petstore_api.configuration.password = 'YOUR_PASSWORD'
configuration = petstore_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = petstore_api.FakeApi()
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
number = 3.4 # float | None
double = 1.2 # float | None
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None

View File

@@ -30,10 +30,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
@@ -80,10 +81,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 789 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
@@ -132,10 +134,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
status = ['status_example'] # list[str] | Status values that need to be considered for filter
try:
@@ -183,10 +186,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
tags = ['tags_example'] # list[str] | Tags to filter by
try:
@@ -234,12 +238,13 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY'
configuration = petstore_api.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer'
# configuration.api_key_prefix['api_key'] = 'Bearer'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 789 # int | ID of pet to return
try:
@@ -287,10 +292,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
@@ -337,10 +343,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 789 # int | ID of pet that needs to be updated
name = 'name_example' # str | Updated name of the pet (optional)
status = 'status_example' # str | Updated status of the pet (optional)
@@ -391,10 +398,11 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
configuration = petstore_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi()
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 789 # int | ID of pet to update
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
file = '/path/to/file.txt' # file | file to upload (optional)

View File

@@ -73,12 +73,13 @@ from petstore_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY'
configuration = petstore_api.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer'
# configuration.api_key_prefix['api_key'] = 'Bearer'
# create an instance of the API class
api_instance = petstore_api.StoreApi()
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
try:
# Returns pet inventories by status