Package: titan-latest
Getting Started with APIMATIC CalculatorGetting StartedIntroductionSimple calculator API hosted on APIMATICInstall the PackageThe package is compatible with Python versions2 >=2.7.9and3 >=3.4.
Install the package from PyPi using the following pip command:pipinstalltitan-latest==3.2.1You can also view the package at:https://pypi.python.org/pypi/titan-latestInitialize the API ClientThe following parameters are configurable for the API Client:ParameterTypeDescriptionenvironmentEnvironmentThe API environment.Default:Environment.PRODUCTIONtimeoutfloatThe 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:fromapimaticcalculator.apimaticcalculator_clientimportApimaticcalculatorClientclient=ApimaticcalculatorClient(environment=Environment.PRODUCTION,)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 DocumentationAPIMATIC CalculatorClientThe 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 expression using the specified operation.:information_source:NoteThis endpoint does not require authentication.defget_calculate(self,options=dict())ParametersParameterTypeTagsDescriptionoperationOperationTypeEnumTemplate, RequiredThe operator to apply on the variablesxfloatQuery, RequiredThe LHS valueyfloatQuery, RequiredThe RHS valueResponse TypefloatExample Usagecollect={}operation=OperationTypeEnum.MULTIPLYcollect['operation']=operationx=222.14collect['x']=xy=165.14collect['y']=yresult=simple_calculator_controller.get_calculate(collect)Model ReferenceEnumerationsOperation TypeOperation TypePossible operators are sum, subtract, multiply, divideClass NameOperationTypeEnumFieldsNameDescriptionSUMRepresents the sum operatorSUBTRACTRepresents the subtract operatorMULTIPLYRepresents the multiply operatorDIVIDERepresents the divide operatorUtility 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.