Skip to main content

Mocean Client Library for Python

Project description

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

Create a client with your API token:

from moceansdk import Client, Basic

credential = Basic(api_token="API_TOKEN_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

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

moceansdk-1.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moceansdk-1.2.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file moceansdk-1.2.0.tar.gz.

File metadata

  • Download URL: moceansdk-1.2.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for moceansdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 af2a06459d3f4b03c38ded46805eabffaf18553685e3ee242de73503482b923a
MD5 780693f83ae610121b6ab00d1e21c15c
BLAKE2b-256 6015655ce3f7b0dee5653848c4f3dcc16b249dbd407f03847c51352075d9a410

See more details on using hashes here.

File details

Details for the file moceansdk-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: moceansdk-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for moceansdk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 541f448da6114502eada3588ecaa0f7dbbc7c409e46f05f50614bd263d369205
MD5 09aafc2c21500b85792031887e2de7d4
BLAKE2b-256 5ab1c664d4e143f0a62a9da4156ee04ebe1900a5f6736733c76b162e57e0654d

See more details on using hashes here.

Supported by

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