MoceanAPI Client Library for Python
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moceansdk-1.3.0.tar.gz | 14.5 kB | Without provenance | Details for moceansdk-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moceansdk-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for moceansdk-1.3.0-py3-none-any.whl |
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
|
Security for moceansdk 1.3.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.