def test_rtr_http_gateway_success(self): username = '******' password = '******' service_key = 'bob12' http_gateway_api = HttpGatewayApi(username, password, service_key) to = '64212431234' from_number = '8222' message = 'bob the builder' msg_id = "515cabc3464af599972c65bc" # dummy out urllib2.urlopen(req) urllib2.urlopen = lambda req: TestRtrHttpGatewayWrapper.UrlResponse(200, msg_id) response = http_gateway_api.push_message(message, to, from_number) self.assertEqual(response, "515cabc3464af599972c65bc")
from runthered.http_gateway import HttpGatewayApi from runthered.http_gateway import HttpGatewayException try: username = '******' password = '******' service_key = 'snop7' http_gateway_api = HttpGatewayApi(username, password, service_key) to = '6421859582' from_number = '2059' message = 'Hello World!' response = http_gateway_api.push_message(message, to, from_number) print "The msg_id is %s"%response msg_id = '55f8ad98e13823069edbdfd6' dlr_response = http_gateway_api.query_dlr(msg_id) print "The status is %s"%dlr_response.status print "The reason is %s"%dlr_response.reason_code print "The dlr id is %s"%dlr_response.id except HttpGatewayException as e: print "Caught exception: %s"%e