Skip to main content

A simple python package to send SMS via HahuCloud API

Project description

API Guide for Hahu Cloud SMS Gateway

This is simple python api for hahucloud sms. It is a RESTful API, and you can use it to send SMS messages to your customers. It is a simple and easy to use API.

This is unofficial API, and it is not supported by Hahu Clouds. It is just a guide for you to use Hahu SMS API. If you have any questions, please contact us.

Contact Information:

- Email: chapimenge3@gmail.com
- Telegram: @chapimenge
- Twitter: @chapimenge
- Linkedin: https://www.linkedin.com/in/chapimenge/

Installation

hahusms is available on PyPI:

python -m pip install hahusms

Hahusms officially supports Python 3.7 and above.

User Guide

Simple API Reference:

from hahusms import SMS

sms = SMS(api_key='your_api_key')

response = sms.send_message(to='+86xxxxxxxx', message='Hello world!')
print(response['status'])
print(response['message'])
print(response['data'])

# Or you can use the following to make the response from json to object

sms = SMS(api_key='your_api_key', response_format="obj")
response = sms.send_message(to='+86xxxxxxxx', message='Hello world!')
print(response.status)
print(response.message)
print(response.data.message)

API Reference

The SMS class the base class for all API calls. You can set the following parameters when you initialize the SMS class:

- api_key: Your API key.
- response_format: The response format. It can be "json" or "obj".
- device (optional): The device id to set your own default device.
- sim (optional): The sim slot to set your own default sim slot.
- priority (optional): The priority of the message. It can be 0 or 1.

To use the above parameters we can use as below

from hahusms import SMS
sms = SMS(api_key='your_api_key', response_format="json",
          device='your_device_id(int)', sim='your_sim_slot(int)',
          priority=1)

You can pass the parameters when you call the API.

sms = SMS(api_key='your_api_key', response_format="obj")
params = {
    "id": 1
}
response = sms.get_device(params=params)
print(response.status)
print(response.message)
print(response.data.name) # The response is object type because we set response_format="obj"

you can always override the SMS class and define your own custom methods to call the API.

Available Methods

SMS class have the following methods:

- create_contact
- create_group
- delete_contact
- delete_group
- get_contacts
- get_groups
- get_device
- get_devices
- get_pending
- get_received
- get_received
- send
- send_message - required parameters: to, message

You can find the official Postman Collection for each method in the API Reference.

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

hahusms-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

hahusms-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file hahusms-0.0.1.tar.gz.

File metadata

  • Download URL: hahusms-0.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for hahusms-0.0.1.tar.gz
Algorithm Hash digest
SHA256 000cdaa341ce7dfebfc8095b6136e60fa382ae671cb7d2cd98d8cd2f4f79c942
MD5 dd86682ffa3ca78d74a3a16854825dc1
BLAKE2b-256 49ceb97973f2bfc8d9ab137bdc4e1d1fba29ce317597f85ffeec98005a7b28f6

See more details on using hashes here.

File details

Details for the file hahusms-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: hahusms-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for hahusms-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ae53bdea4fe1d7e122235cb51d398276e99736c324f09af725cd380a76e723c
MD5 606b81e35af40fccead2af6015d079c5
BLAKE2b-256 d24f73551f152026566ff71eec908adf9fc7b892b38cc9c6c4e6087a7c333a19

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