Skip to main content

Simple calculator API hosted on APIMATIC

Project description

Getting Started with APIMATIC Calculator

Getting Started

Introduction

Simple calculator API hosted on APIMATIC

Install the Package

The package is compatible with Python versions 2 >=2.7.9 and 3 >=3.4. Install the package from PyPi using the following pip command:

pip install titan-latest==3.2.1

You can also view the package at: https://pypi.python.org/pypi/titan-latest

Initialize the API Client

The following parameters are configurable for the API Client:

Parameter Type Description
environment Environment The API environment.
Default: Environment.PRODUCTION
timeout float The value to use for connection timeout.
Default: 60
max_retries int The number of times to retry an endpoint call if it fails.
Default: 3
backoff_factor float A backoff factor to apply between attempts after the second try.
Default: 0

The API client can be initialized as follows:

from apimaticcalculator.apimaticcalculator_client import ApimaticcalculatorClient

client = ApimaticcalculatorClient(
    environment = Environment.PRODUCTION,)

Test the SDK

You can test the generated SDK and the server with test cases. unittest is used as the testing framework and nose is used as the test runner. You can run the tests as follows:

Navigate to the root directory of the SDK and run the following commands

pip install -r test-requirements.txt
nosetests

Client Class Documentation

APIMATIC CalculatorClient

The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.

Controllers

Name Description
simple_calculator Provides access to SimpleCalculatorController

API Reference

List of APIs

Simple Calculator

Overview

Get instance

An instance of the SimpleCalculatorController class can be accessed from the API Client.

simple_calculator_controller = client.simple_calculator

Get Calculate

Calculates the expression using the specified operation.

:information_source: Note This endpoint does not require authentication.

def get_calculate(self,
                 options=dict())
Parameters
Parameter Type Tags Description
operation OperationTypeEnum Template, Required The operator to apply on the variables
x float Query, Required The LHS value
y float Query, Required The RHS value
Response Type

float

Example Usage
collect = {}
operation = OperationTypeEnum.MULTIPLY
collect['operation'] = operation

x = 222.14
collect['x'] = x

y = 165.14
collect['y'] = y

result = simple_calculator_controller.get_calculate(collect)

Model Reference

Enumerations

Operation Type

Possible operators are sum, subtract, multiply, divide

Class Name

OperationTypeEnum

Fields
Name Description
SUM Represents the sum operator
SUBTRACT Represents the subtract operator
MULTIPLY Represents the multiply operator
DIVIDE Represents the divide operator

Utility Classes Documentation

ApiHelper

A utility class for processing API Calls. Also contains classes for supporting standard datetime formats.

Methods

Name Description
json_deserialize Deserializes a JSON string to a Python dictionary.

Classes

Name Description
HttpDateTime A wrapper for datetime to support HTTP date format.
UnixDateTime A wrapper for datetime to support Unix date format.
RFC3339DateTime A wrapper for datetime to support RFC3339 format.

Common Code Documentation

HttpResponse

Http response received.

Parameters

Name Type Description
status_code int The status code returned by the server.
reason_phrase str The reason phrase returned by the server.
headers dict Response headers.
text str Response body.
request HttpRequest The request that resulted in this response.

HttpRequest

Represents a single Http Request.

Parameters

Name Type Tag Description
http_method HttpMethodEnum The HTTP method of the request.
query_url str The endpoint URL for the API request.
headers dict optional Request headers.
query_parameters dict optional Query parameters to add in the URL.
parameters dict | str optional Request body, either as a serialized string or else a list of parameters to form encode.
files dict optional Files to be sent with the request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

titan-latest-3.2.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

titan_latest-3.2.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file titan-latest-3.2.1.tar.gz.

File metadata

  • Download URL: titan-latest-3.2.1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for titan-latest-3.2.1.tar.gz
Algorithm Hash digest
SHA256 86432f05a2142443b6facce5afd03d8e62ba04b00798f3eba6cf346b941af771
MD5 c7a7bacf28031a096b13ea1979817506
BLAKE2b-256 6fbc72c8717dfc17715e5e1b5876bc684295eb6e701579a49799c21c6d51befd

See more details on using hashes here.

File details

Details for the file titan_latest-3.2.1-py3-none-any.whl.

File metadata

  • Download URL: titan_latest-3.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for titan_latest-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e34b4f3fda553f34bdf9951020e60fc21f68b0f7bf02bc253725fb78daa962ad
MD5 f2be6b8788c117690dbef59ef02d5824
BLAKE2b-256 458d4064756b676443ed6a1d5f93a751440abb10b3643aac8e869695b56ada5b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page