Skip to main content

Python client for remote communication with SerwerSMS.pl API v2

Project description

SerwerSMS.pl Python Client API

Python client for remote communication with SerwerSMS.pl API v2

Attention. The current version works based on the API token.

In order to authorize via an API Token, it must be generated on the Customer Panel side in the Interface Settings → HTTPS API → API Tokens menu. The authorization header format follows the Bearer token format.

Example usage

import sys
import json

from serwersms import SerwerSMS

api = SerwerSMS('token')

try:

    params = {
        'test': 'true',
        'details': 'true'
    }

    response = api.message.send_sms('500600700', 'Test message', 'INFORMACJA', params)

    result = json.loads(response)

    if 'items' not in result:
        raise Exception('Empty items')

    for item in result['items']:
        print(item['id'] + ' - ' + item['phone'] + ' - ' + item['status'])
        
except Exception:

    print('ERROR: ', sys.exc_info()[1])

Sending SMS

api = SerwerSMS('token')

try:

    params = {
        'details': 'true'
    }

    response = api.message.send_sms('500600700', 'Test message', 'INFORMACJA', params)
    
    print(response)
    
except Exception:

    print('ERROR: ', sys.exc_info()[1])

Sending personalized SMS

api = SerwerSMS('token')

try:

    messages = []

    message1 = {
        'phone': '500600700',
        'text': 'First message'
    }
    
    messages.append(message1)

    message2 = {
        'phone': '600700800',
        'text': 'Second  message'
    }
    
    messages.append(message2)

    params = {
        'details': 'true'
    }

    response = api.message.send_personalized(messages, 'INFORMACJA', params)
    
    print(response)
    
except Exception:

    print('ERROR: ', sys.exc_info()[1])

Downloading delivery reports

api = SerwerSMS('token')

try:

    params = {
        'id': 'aca3944055'
    }
    
    response = api.message.reports(params)
    
    print(response)
    
except Exception:

    print('ERROR: ', sys.exc_info()[1])

Downloading incoming messages

api = SerwerSMS('token')

try:

    params = {
        'phone': '500600700'
    }
    response = api.message.recived('ndi',params)
    
    print(response)
    
except Exception:

    print('ERROR: ', sys.exc_info()[1])

Requirements

Python 3.5.*

Documentation

http://dev.serwersms.pl

API Console

http://apiconsole.serwersms.pl

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

serwersmsv2api-0.0.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

serwersmsv2api-0.0.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serwersmsv2api-0.0.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.0a7

File hashes

Hashes for serwersmsv2api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0f8a8e132f51d545b6ab255de73cd285c0a2268926d79dc0696aa97d95bb1741
MD5 3bef5dc5f15ddb9d763acdc5957d9de6
BLAKE2b-256 9e48c8ff67d3e4fe630ba349d91ca4df329fe68d886b925ce3ea8e1a1a380b8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serwersmsv2api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.0a7

File hashes

Hashes for serwersmsv2api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d1dc38fb4966d264c43e2ffb3fc8ce72deb833fbc3d4dcc82278b5fc3435be
MD5 c5d6f3b2c9bb1963222d53d3216eeabc
BLAKE2b-256 e1cc3fe8910f45c27583f1b412b51f3a6da71dfd05a9add90957dac29e3526e9

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