API

This part of the documentation lists the full API documentation of all public classes and functions.

Core

ibires.core.send(to, text, url, user, password, sender, timeout=5)

Send message text to target number.

Parameters:
  • to (list|str) – Array of message destination addresses. If you want to send a message to one destination, a single String is supported instead of an Array. Destination addresses must be in international format (Example: ‘41793026727’).
  • text (str) – Text of the message that will be sent.
  • url (str) – url to post to.
  • user (str) – username.
  • password (str) – password.
  • sender (str) – Represents sender ID and it can be alphanumeric or numeric. Alphanumeric sender ID length should be between 3 and 11 characters (Example: 'CompanyName'). Numeric sender ID length should be between 3 and 14 characters.
  • timeout (int) – timeout in seconds.
ibires.core.make_headers(user, password)

Create headers dict.

Parameters:
  • user (str) – username.
  • password (str) – password.

Reports

ibires.reports.gen_accepted(to='919999999999', text=None, error=False)

Returns accepted response (when SMS is posted).

Parameters:
  • to (list|str) – Array of message destination addresses. If you want to send a message to one destination, a single String is supported instead of an Array. Destination addresses must be in international format (Example: 41793026727).
  • text (str) – Text of the message that will be sent.
  • error (bool) – True if a random error should happen.
ibires.reports.gen_dlr(to='919999999999', text=None, delivered=True, time=None, bulkId=False, country_code=None)

Returns final delivery report.

Parameters:
  • to (str) – target number.
  • delivered (bool) – True if dlr should tell that message has been delivered.
  • time (int) – Timestamp as epoch of sentAt and doneAt of dlr. Default of None effects arrow.now().
  • bulkId (bool) – Has the message been posted to multiple recipients?
  • country_code (int) – country_code to restrict random mccMnc choice to.

Building blocks of reports

ibires.reports.gen_msgid()

Returns msgid which is UUID.

ibires.reports.gen_status(delivered=True)

Returns status of message.

Parameters:delivered – True if status should indicate that message has been delivered.
ibires.reports.gen_error(delivered=True)

Generate error report.

Parameters:gen_error – True if error should indicate that message has been delivered.
ibires.reports.gen_mccMnc(country_code=None)

Return random mccMnc that is HNI. HNI = ‘MCC’ + ‘MNC’ IMSI = ‘HNI’ + ‘MSIN’ MCC is Mobile Country Code. MNC is Mobile Network Code. MSIN is Mobile Subscriber Identity Number. IMSI is Integrated Mobile Subscriber Identity.

Parameters:country_code (int) – to restrict selection to.

Strip a report

ibires.reports.strip_report(report, json=False)

Get the bare delivery report.

Parameters:
  • report – the delivery report as json or dict.
  • json (bool) – True if output should be json else dict is returned.

Simulate

ibires.simulate.sms_server(url, user, password, sender)

Function to mock infobip’s single messaging interface.

Parameters:
  • url (str) – url to post to.
  • user (str) – username.
  • password (str) – password.
  • sender (str) – Represents sender ID and it can be alphanumeric or numeric. Alphanumeric sender ID length should be between 3 and 11 characters (Example: 'CompanyName'). Numeric sender ID length should be between 3 and 14 characters.