Opera

Opera Transport

exception vumi.transports.opera.opera.BadRequestError

Bases: exceptions.Exception

An exception we can throw while parsing a request to return a 400 response.

class vumi.transports.opera.opera.OperaTransport(options, config=None)

Bases: vumi.transports.base.Transport

Opera transport.

See https://dragon.sa.operatelecom.com:1089/ for documentation on the Opera XML-RPC interface.

Configuration options:

Parameters:
  • message_id_lifetime (int) – Seconds message ids should be kept for before expiring. Once an id expires, delivery reports can no longer be associated with the original message id. Default is one week.
  • web_receipt_path (str) – Path part of JSON reply URL (should match value given to Opera). E.g. /api/v1/sms/opera/receipt.json
  • web_receive_path (str) – Path part of XML reply URL (should match value given to Opera). E.g. /api/v1/sms/opera/receive.xml
  • web_port (int) – Port the transport listens to for responses from Opera. Affects both web_receipt_path and web_receive_path.
  • url (str) – Opera XML-RPC gateway. E.g. https://dragon.sa.operatelecom.com:1089/Gateway
  • channel (str) – Opera channel number.
  • password (str) – Opera password.
  • service (str) – Opera service number.
  • max_segments (int) – Maximum number of segments to allow messages to be broken into. Default is 9. Minimum is 1. Maximum is 9. Note: Opera’s own default is 1. This transport defaults to 9 to minimise the possibility of message sends failing.
get_message_id_for_identifier(identifier)

Get an internal message id for a given identifier

Parameters:identifier (str) – The message id we originally got from Opera when the message was accepted for delivery.
get_transport_url(suffix='')

Get the URL for the HTTP resource. Requires the worker to be started.

This is mostly useful in tests, and probably shouldn’t be used in non-test code, because the API might live behind a load balancer or proxy.

handle_outbound_message_failure(*args, **kwargs)

Decide what to do on certain failure cases.

set_message_id_for_identifier(identifier, message_id)

Link an external message id, the identifier, to an internal message id for MAX_ID_LIFETIME amount of seconds

Parameters:
  • identifier (str) – The message id we get back from Opera
  • message_id (str) – The internal message id that was used when the message was sent.
validate_config()

Transport-specific config validation happens in here.