ReSMS Logo
Skip to Content

Python

Welcome to the ReSMS Python integration guide.

This guide explains how you can quickly and securely send SMS messages using the ReSMS API in your Python applications.

Installation

First, install our official ReSMS Python SDK:

pip install resms

Setup

You need to get an API key on ReSMS Dashboard. Then import the package and create a new instance of the ReSMS class with your API key.

from resms import ReSMS sms = ReSMS("re_12345")

Quickstart

Here’s a minimal example to send an SMS:

from resms import ReSMS sms = ReSMS("re_12345") sms.send(to="+33123456789", text="Your sign-in code is 123456")

Environment Variables

To keep it secure, we recommend using environment variables to store your API key.

export RESMS_API_KEY=your-api-key-here

Then, in your code, you can access it like this:

import os from resms import ReSMS sms = ReSMS(os.environ["RESMS_API_KEY"])

Error Handling

All API calls can throw errors. We recommend wrapping your SMS calls with try-except:

from resms import ReSMS sms = ReSMS("re_12345") try: result = sms.send(to="+33123456789", text="Your sign-in code is 123456") print("SMS sent successfully:", result) except Exception as e: print("Failed to send SMS:", e)

Going Further


Need help? Contact our support at contact@resms.dev

Last updated on