Package: hamzaShoukatpy
Getting Started with Swagger PetstoreIntroductionThis is a sample server Petstore server.  You can find out more about Swagger athttp://swagger.ioor onirc.freenode.net, #swagger.  For this sample, you can use the api keyspecial-keyto test the authorization filters.Find out more about Swagger:http://swagger.ioInstall the PackageThe package is compatible with Python versions3 >=3.7, <= 3.9.
Install the package from PyPi using the following pip command:pipinstallhamzaShoukatpy==2.0You can also view the package at:https://pypi.python.org/pypi/hamzaShoukatpyInitialize the API ClientNote:Documentation for the client can be foundhere.The following parameters are configurable for the API Client:ParameterTypeDescriptionenvironmentEnvironmentThe API environment.Default:Environment.PRODUCTIONhttp_client_instanceHttpClientThe Http Client passed from the sdk user for making requestsoverride_http_client_configurationboolThe value which determines to override properties of the passed Http Client from the sdk userhttp_call_backHttpCallBackThe callback value that is invoked before and after an HTTP call is made to an endpointtimeoutfloatThe value to use for connection timeout.Default: 60max_retriesintThe number of times to retry an endpoint call if it fails.Default: 0backoff_factorfloatA backoff factor to apply between attempts after the second try.Default: 2retry_statusesArray of intThe http statuses on which retry is to be done.Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]retry_methodsArray of stringThe http methods on which retry is to be done.Default: ['GET', 'PUT']custom_header_api_keystringo_auth_client_idstringOAuth 2 Client IDo_auth_redirect_uristringOAuth 2 Redirection endpoint or Callback Urio_auth_tokenOAuthTokenObject for storing information about the OAuth tokeno_auth_scopesOAuthScopeEnumThe API client can be initialized as follows:fromswaggerpetstore.swaggerpetstore_clientimportSwaggerpetstoreClientfromswaggerpetstore.configurationimportEnvironmentclient=SwaggerpetstoreClient(custom_header_api_key='CustomHeaderApiKey',o_auth_client_id='OAuthClientId',o_auth_redirect_uri='OAuthRedirectUri',o_auth_scopes=[OAuthScopeEnum.READPETS,OAuthScopeEnum.WRITEPETS],environment=Environment.PRODUCTION,)AuthorizationThis API usesCustom Header Signature,OAuth 2 Implicit Grant.Implicit GrantYour application must obtain user authorization before it can execute an endpoint call incase this SDK chooses to useOAuth 2.0 Implicit Grantto obtain a user's consent to perform an API request on user's behalf. This authorization includes the following stepsThis process requires the presence of a client-side JavaScript code on the redirect URI page to receive theaccess tokenafter the consent step is completed.1. Obtain user consentTo obtain user's consent, you must redirect the user to the authorization page. Theget_authorization_url()method creates the URL to the authorization page. You must pass the scopes for which you need permission to access.auth_url=client.auth_managers['petstoreAuth'].get_authorization_url()2. Handle the OAuth server responseOnce the user responds to the consent request, the OAuth 2.0 server responds to your application's access request by redirecting the user to the redirect URI specified set inConfiguration.The redirect URI will receive theaccess tokenas thetokenargument in the URL fragment.https://example.com/oauth/callback#token=XXXXXXXXXXXXXXXXXXXXXXXXXThe access token must be extracted by the client-side JavaScript code. The access token can be used to authorize any further endpoint calls by the JavaScript code.ScopesScopes enable your application to only request access to the resources it needs while enabling users to control the amount of access they grant to your application. Available scopes are defined in theOAuthScopeEnumenumeration.Scope NameDescriptionREADPETSread your petsWRITEPETSmodify pets in your accountList of APIsPetStoreUserClasses DocumentationUtility ClassesHttpResponseHttpRequest