> For the complete documentation index, see [llms.txt](https://help.clickatell.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.clickatell.com/developers-api-reference/developers-archive/bulk-sms-scripts/python-library.md).

# Python library

**Overview**

Use Clickatell’s Python library with our HTTP or REST messaging APIs to interact with the Clickatell SMS Gateway.

[Get Python library](https://github.com/clickatell/clickatell-python)

\
**When to use this**

Used for developing programs and websites. After signing up, use this Python library to incorporate it into your current systems.

\
**Installation**

You can install this library via PIP as part of your requirements file.

| `pip install clickatell` |
| ------------------------ |

&#x20;

[Clickatell Python PyPI](https://pypi.python.org/pypi?name=clickatell\&version=0.0.1&:action=display)

\
**Usage**

The library currently supports the `Http` and `Rest` protocols.

\
**HTTP API**

| `from` `clickatell.http import` `Http` `clickatell =` `Http(username, password, apiID)response =` `clickatell.sendMessage(['1111111111'], "My Message")` `for` `entry in` `response:    print(entry['id'])    # entry['id']    # entry['destination']    # entry['error']    # entry['errorCode']` |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

&#x20;

**REST API**

| `from` `clickatell.rest import` `Rest` `clickatell =` `Rest(token);response =` `clickatell.sendMessage(['1111111111'], "My Message")` `for` `entry in` `response:    print(entry['id'])    # entry['id']    # entry['destination']    # entry['error']    # entry['errorCode']` |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

&#x20;

**Sending to multiple numbers**

The `sendMessage` call `to` parameter can take an array of numbers. If you specify only a single number like

&#x20;

| `clickatell.sendMessage(1111111111, "Message")` |
| ----------------------------------------------- |

&#x20;

the library will automatically convert it to an array for your convenience.

&#x20;

**Supported API calls**

The available calls are defined in the `clickatell.Transport` interface.

| `def` `sendMessage(self, to, message, extra={})` `def` `getBalance(self)` `def` `stopMessage(self, apiMsgId)` `def` `queryMessage(self, apiMsgId)` `def` `routeCoverage(self, msisdn)` `def` `getMessageCharge(self, apiMsgId)` |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

&#x20;

**Dealing with extra parameters in sendMessage**

For usability purposes the `sendMessage` call focuses on the recipients and the content. In order to specify and of the additional parameters defined in the Clickatell document, you can use the `extra` parameter and pass them as a dictionary.

You can see our other libraries and more documentation at the [Clickatell APIs and Libraries Project](http://clickatell.github.io/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.clickatell.com/developers-api-reference/developers-archive/bulk-sms-scripts/python-library.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
