Skip to main content

MoceanAPI Client Library for Python

Latest Stable Version Github Build Status codecov codacy license

This is the Python client library for use Mocean's API. To use this, you'll need a Mocean account. Sign up for free at moceanapi.com.

Installation

To use the client library you'll need to have created a Mocean account.

Install from PyPi using pip, a package manager for Python.

pip install moceansdk

Usage

For version >=1.2.0

There are 2 ways to connect to MoceanAPI

Option 1: Create a client with your API token

from moceansdk import Client, Basic

credential = Basic(api_token="API_TOKEN_HERE")
mocean = Client(credential)

Option 2 (legacy): Create a client with your API key and secret

from moceansdk import Client, Basic

credential = Basic(api_key="API_KEY_HERE", api_secret="API_SECRET_HERE")
mocean = Client(credential)

For version <1.2.0

Create a client with your API key and secret:

from moceansdk import Client, Basic

credential = Basic("API_KEY_HERE", "API_SECRET_HERE")
mocean = Client(credential)

Example

To use Mocean's SMS API to send an SMS message, call the mocean.sms.send() method.

The API can be called directly, using a simple array of parameters, the keys match the parameters of the API.

res = mocean.sms.send({
    "mocean-from": "MOCEAN",
    "mocean-to": 60123456789,
    "mocean-text": "Hello World"
})

print(res)

Responses

For your convenient, the API response has been parsed to dict using dotmap package.

print(res)           # show full response string
print(res.status)    # show response status, '0' in this case
print(res['status']) # same as above

Documentation

Kindly visit MoceanApi Docs for more usage

License

This library is released under the MIT License

Metadata

Release files for moceansdk 1.3.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 moceansdk 1.3.0
File Size Uploaded
moceansdk-1.3.0.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moceansdk 1.3.0
File Interpreter ABI Platform
moceansdk-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.5 kB

Release files / moceansdk-1.3.0.tar.gz

Download URL moceansdk-1.3.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c5f9237a243785e471166ea1cfc28aa8d348c3f072013848bbc5c892e5aa2a88
BLAKE2b-256 checksum
How to use checksums
23711b2aa8ed6a949b1c8a2368774d91242f433df104c314119bb5e42b9fe308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / moceansdk-1.3.0-py3-none-any.whl

Download URL moceansdk-1.3.0-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f88088df572ec3955a08405b043ceb80abe07b6a947a72f56a53354c1d976af
BLAKE2b-256 checksum
How to use checksums
8fcd66dc55d51bdec56bdafa3ca169283d4221c3317a1491d084a0940f49d20b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

1 release file

1.0.2

1 release file

1.0.1

2 release files

1.0.0

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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