Package: apimatic-calculator-py
Getting Started with MyCalculatorGetting StartedIntroductionCalculator API built with APIMATICInstall the PackageThe package is compatible with Python versions2 >=2.7.9and3 >=3.4.
Install the package from PyPi using the following pip command:pipinstallapimatic-calculator-py==1.0You can also view the package at:https://pypi.python.org/pypi/apimatic-calculator-pyInitialize the API ClientThe following parameters are configurable for the API Client:ParameterTypeDescriptiontimeoutfloatThe value to use for connection timeout.Default: 60max_retriesintThe number of times to retry an endpoint call if it fails.Default: 3backoff_factorfloatA backoff factor to apply between attempts after the second try.Default: 0The API client can be initialized as follows:frommycalculator.mycalculator_clientimportMycalculatorClientclient=MycalculatorClient()Test the SDKYou can test the generated SDK and the server with test cases.unittestis used as the testing framework andnoseis used as the test runner. You can run the tests as follows:Navigate to the root directory of the SDK and run the following commandspip install -r test-requirements.txt
nosetestsClient Class DocumentationMyCalculatorClientThe gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.ControllersNameDescriptionsimple_calculatorProvides access to SimpleCalculatorControllerAPI ReferenceList of APIsSimple CalculatorSimple CalculatorOverviewGet instanceAn instance of theSimpleCalculatorControllerclass can be accessed from the API Client.simple_calculator_controller = client.simple_calculatorGet CalculateCalculates the result for the specified operation and variables.:information_source:NoteThis endpoint does not require authentication.defget_calculate(self,operation,x,y)ParametersParameterTypeTagsDescriptionoperationOperationEnumTemplate, RequiredThe operator to be applied on the provided variables.xfloatQuery, RequiredThe LHS valueyfloatQuery, RequiredThe RHS valueResponse TypefloatExample Usageoperation=OperationEnum.SUMx=222.14y=165.14result=simple_calculator_controller.get_calculate(operation,x,y)Example Response2.5Model ReferenceEnumerationsOperation TypeOperationOperation TypeOperations types include: SUM, SUBTRACT, DIVIDE, MULTIPLYClass NameOperationTypeEnumFieldsNameDescriptionSUMAdds the specified variables.SUBTRACTSubtracts the specified variables.MULTIPLYMultiplies the specified variables.DIVIDEDivides the specified variables.OperationClass NameOperationEnumFieldsNameDescriptionSUMAdds the specified variables.SUBTRACTSubtracts the specified variables.MULTIPLYMultiplies the specified variables.DIVIDEDivides the specified variables.Utility Classes DocumentationApiHelperA utility class for processing API Calls. Also contains classes for supporting standard datetime formats.MethodsNameDescriptionjson_deserializeDeserializes a JSON string to a Python dictionary.ClassesNameDescriptionHttpDateTimeA wrapper for datetime to support HTTP date format.UnixDateTimeA wrapper for datetime to support Unix date format.RFC3339DateTimeA wrapper for datetime to support RFC3339 format.Common Code DocumentationHttpResponseHttp response received.ParametersNameTypeDescriptionstatus_codeintThe status code returned by the server.reason_phrasestrThe reason phrase returned by the server.headersdictResponse headers.textstrResponse body.requestHttpRequestThe request that resulted in this response.HttpRequestRepresents a single Http Request.ParametersNameTypeTagDescriptionhttp_methodHttpMethodEnumThe HTTP method of the request.query_urlstrThe endpoint URL for the API request.headersdictoptionalRequest headers.query_parametersdictoptionalQuery parameters to add in the URL.parametersdict | stroptionalRequest body, either as a serialized string or else a list of parameters to form encode.filesdictoptionalFiles to be sent with the request.