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.9.*

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.2.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.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serwersmsv2api-0.0.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for serwersmsv2api-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d8b3cabb80d85bb75708395cb20abb157cc1bf7f0c7959280fa3ed829c45a8b8
MD5 0a2707bced1d0353d34012744706f1c3
BLAKE2b-256 8882038b06de891043333fb31e3e76fe9a49a7d3153a3f0e1e22b4cb950ac1e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serwersmsv2api-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for serwersmsv2api-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ec350cfc7e65726eb7303981086422b7ad17ee7d8987f56e825c840ed142695
MD5 bd7ab278514e9c457b56652a5eeaaccd
BLAKE2b-256 e724d841893b0a45551464cf6a505abcd31a6c3f2b204f47893ab51f784a9345

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