def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.unsub_data = { "address": "*****@*****.**", "tag": "unsub_test_tag" } self.unsub_json_data = [{ "address": "*****@*****.**", "tags": ["some tag"], "error": "Test error2312" }, { "address": "*****@*****.**", "code": ["*"], "error": "Test error" }, { "address": "*****@*****.**" }]
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.post_template_data = {'name': 'template.name20', 'description': 'template description', 'template': '{{fname}} {{lname}}', 'engine': 'handlebars', 'comment': 'version comment'} self.put_template_data = {'description': 'new template description'} self.post_template_version_data = {'tag': 'v11', 'template': '{{fname}} {{lname}}', 'engine': 'handlebars', 'active': 'no' } self.put_template_version_data = { 'template': '{{fname}} {{lname}}', 'comment': 'Updated version comment', 'active': 'no' } self.put_template_version = 'v11'
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.params = { "event": "rejected" }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.ip_data = { "ip": os.environ["DOMAINS_DEDICATED_IP"] }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.params = { "event": ["accepted"], "duration": "1m" }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.data = {"from": os.environ["MESSAGES_FROM"], "to": os.environ["MESSAGES_TO"], "cc": os.environ["MESSAGES_CC"], "subject": "Hello Vasyl Bodaj", "text": "Congratulations !!!!!, you just sent an email with Mailgun! You are truly awesome!", "o:tag": "Python test"}
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.post_inbox_test = { 'domain': 'domain.com', 'from': 'user@sending_domain.com', 'subject': 'testSubject', 'html': '<html>HTML version of the body</html>' }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.webhooks_data = { 'id': 'clicked', 'url': ['https://i.ua'] } self.webhooks_data_put = { 'url': 'https://twitter.com' }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.test_domain = "mailgun.wrapper.test2" self.post_domain_data = { "name": self.test_domain, } self.post_domain_creds = { "login": "******".format(domain=self.domain), "password": "******" } self.put_domain_creds = { "password": "******" } self.put_domain_connections_data = { "require_tls": "false", "skip_verification": "false" } self.put_domain_tracking_data = { "active": "yes", "skip_verification": "false" } self.put_domain_unsubscribe_data = { "active": "yes", "html_footer": "\n<br>\n<p><a href=\"%unsubscribe_url%\">UnSuBsCrIbE</a></p>\n", "text_footer": "\n\nTo unsubscribe here click: <%unsubscribe_url%>\n\n" } self.put_domain_dkim_authority_data = { "self": "false" } self.put_domain_webprefix_data = { "web_prefix": "python" } self.put_dkim_selector_data = { "dkim_selector": "s" }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.data = { "description": "Tests running" } self.put_tags_data = { "description": "Python testtt" } self.stats_params = { "event": "accepted" } self.tag_name = "Python test"
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.data = { "name": "test_pool", "description": "Test", "add_ip": os.environ["DOMAINS_DEDICATED_IP"] } self.patch_data = { "name": "test_pool1", "description": "Test1" } self.ippool_id = ""
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.validation_address_1 = os.environ["VALIDATION_ADDRESS_1"] self.validation_address_2 = os.environ["VALIDATION_ADDRESS_2"] self.get_params_address_validate = { "address": self.validation_address_1, "provider_lookup": "false" } self.post_params_address_validate = { "provider_lookup": "false" } self.post_address_validate = {"address": self.validation_address_1}
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.routes_data = { "priority": 0, "description": "Sample route", "expression": "match_recipient('.*@{domain_name}')".format(domain_name=self.domain), "action": ["forward('http://myhost.com/messages/')", "stop()"] } self.routes_params = { "skip": 1, "limit": 1 } self.routes_put_data = { "priority": 2 }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.whitel_data = { "address": "*****@*****.**", "tag": "whitel_test" } self.whitl_json_data = [{ "address": "*****@*****.**", "domain": self.domain }, { "address": "*****@*****.**", "domain": self.domain }]
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.maillist_address = os.environ["MAILLIST_ADDRESS"] self.mailing_lists_data = { 'address': 'python_sdk@{domain}'.format(domain=self.domain), 'description': "Mailgun developers list" } self.mailing_lists_data_update = { 'description': "Mailgun developers list 121212" } self.mailing_lists_members_data = { 'subscribed': True, 'address': '*****@*****.**', 'name': 'Bob Bar', 'description': 'Developer', 'vars': '{"age": 26}' } self.mailing_lists_members_put_data = { 'subscribed': True, 'address': '*****@*****.**', 'name': 'Bob Bar', 'description': 'Developer', 'vars': '{"age": 28}' } self.mailing_lists_members_data_mult = { 'upsert': True, 'members': '[{"address": "Alice <*****@*****.**>", "vars": {"age": 26}},' '{"name": "Bob", "address": "*****@*****.**", "vars": {"age": 34}}]' }
def setUp(self): self.auth = ( "api", os.environ["APIKEY"] ) self.client = Client(auth=self.auth) self.domain = os.environ["DOMAIN"] self.bounces_data = { "address": "*****@*****.**", "code": 550, "error": "Test error" } self.bounces_json_data = [{ "address": "*****@*****.**", "code": "550", "error": "Test error2312" }, { "address": "*****@*****.**", "code": "550", "error": "Test error" }]
import os from mailgun.client import Client key = os.environ["APIKEY"] domain = os.environ["DOMAIN"] client = Client(auth=("api", key)) def get_domain_events(): """ GET /<domain>/events :return: """ req = client.events.get(domain=domain) print(req.json()) def view_message_with_storage_url(): """ https://sw.api.mailgun.net/v3/domains/2048.zeefarmer.com/messages/{storage_url} :return: """ params = {"limit": 1} storage_url = client.events.get( domain=domain, filters=params).json()["items"][0]["storage"]["url"] req = client.domains_messages.get(domain=domain, api_storage_url=storage_url) print(req.json())