Skip to main content

Getting Started with MyCalculator

Getting Started

Introduction

Calculator API built with 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 apimatic-calculator-py==1.0

You can also view the package at: https://pypi.python.org/pypi/apimatic-calculator-py

Initialize the API Client

The following parameters are configurable for the API Client:

Parameter Type Description
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 mycalculator.mycalculator_client import MycalculatorClient

client = MycalculatorClient()

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

MyCalculatorClient

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 result for the specified operation and variables.

:information_source: Note This endpoint does not require authentication.

def get_calculate(self,
                 operation,
                 x,
                 y)
Parameters
Parameter Type Tags Description
operation OperationEnum Template, Required The operator to be applied on the provided variables.
x float Query, Required The LHS value
y float Query, Required The RHS value
Response Type

float

Example Usage
operation = OperationEnum.SUM
x = 222.14
y = 165.14

result = simple_calculator_controller.get_calculate(operation, x, y)
Example Response
2.5

Model Reference

Enumerations

Operation Type

Operations types include: SUM, SUBTRACT, DIVIDE, MULTIPLY

Class Name

OperationTypeEnum

Fields
Name Description
SUM Adds the specified variables.
SUBTRACT Subtracts the specified variables.
MULTIPLY Multiplies the specified variables.
DIVIDE Divides the specified variables.

Operation

Class Name

OperationEnum

Fields
Name Description
SUM Adds the specified variables.
SUBTRACT Subtracts the specified variables.
MULTIPLY Multiplies the specified variables.
DIVIDE Divides the specified variables.

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.

Metadata

Release files for apimatic-calculator-py 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apimatic-calculator-py 1.0
File Size Uploaded Provenance
apimatic-calculator-py-1.0.tar.gz 15.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for apimatic-calculator-py 1.0
File Interpreter ABI Platform
apimatic_calculator_py-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / apimatic-calculator-py-1.0.tar.gz

Download URL apimatic-calculator-py-1.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b1d620585d627d6f0ea2b4e964af0f0ec66171a9dd721981f4750687c3c1345
BLAKE2b-256 checksum
How to use checksums
21f0ff877c0e4d75f7704ed11322933ce0ca367565d3d610b7c86b295d76a12e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / apimatic_calculator_py-1.0-py3-none-any.whl

Download URL apimatic_calculator_py-1.0-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c4e586bf6c2173c95ebb13cc545dca983466ed6765076e3712e74bc80221366
BLAKE2b-256 checksum
How to use checksums
15f29d7dfa712deabd7832f44ef56adb37c1ea66925f3b7c2ca1ea27e5b98960
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for apimatic-calculator-py 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page