brynq-sdk-mandrill 2.0.1__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/PKG-INFO +1 -1
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill/mail_client.py +19 -12
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/PKG-INFO +1 -1
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/requires.txt +1 -1
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/setup.py +2 -2
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill/__init__.py +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill/templates/mail_brynq.html +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/not-zip-safe +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/top_level.txt +0 -0
- {brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/setup.cfg +0 -0
|
@@ -3,29 +3,36 @@ import os
|
|
|
3
3
|
import mandrill
|
|
4
4
|
import codecs
|
|
5
5
|
import base64
|
|
6
|
-
from typing import Union, List, Optional, BinaryIO
|
|
6
|
+
from typing import Union, List, Optional, BinaryIO, Literal
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class MailClient(BrynQ):
|
|
10
|
-
def __init__(self,
|
|
10
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug=False):
|
|
11
11
|
# This is built in so you can use this class as a query generator for the BrynQ Agent
|
|
12
12
|
super().__init__()
|
|
13
13
|
self.debug = debug
|
|
14
|
-
|
|
15
|
-
credentials = self.
|
|
14
|
+
try:
|
|
15
|
+
credentials = self.interfaces.credentials.get(system="mandrill", system_type=system_type)
|
|
16
|
+
credentials = credentials.get('data')
|
|
16
17
|
self.api_token = credentials['token']
|
|
17
18
|
self.email_from = 'support@brynq.com' if credentials['email_from'] is None else credentials['email_from']
|
|
18
19
|
self.name_from = 'BrynQ' if credentials['name_from'] is None else credentials['name_from']
|
|
19
20
|
if self.debug:
|
|
20
21
|
print('Retrieved credentials from BrynQ')
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
self.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
except ValueError as e:
|
|
23
|
+
print("No authorization found connected to interface")
|
|
24
|
+
self.api_token = None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if self.api_token is None:
|
|
28
|
+
if os.getenv("MANDRILL_TOKEN") is not None:
|
|
29
|
+
self.api_token = os.getenv("MANDRILL_TOKEN")
|
|
30
|
+
self.email_from = 'connect@salure.nl' if os.getenv("MANDRILL_EMAIL_FROM") is None else os.getenv("MANDRILL_EMAIL_FROM")
|
|
31
|
+
self.name_from = 'BrynQ' if os.getenv("MANDRILL_NAME_FROM") is None else os.getenv("MANDRILL_NAME_FROM")
|
|
32
|
+
if self.debug:
|
|
33
|
+
print('Retrieved credentials from environment variables')
|
|
34
|
+
else:
|
|
35
|
+
raise ValueError('No credentials found for Mandrill. Either authorize Mandrill to your interface in BrynQ or set the environment variables MANDRILL_TOKEN, MANDRILL_EMAIL_FROM and MANDRILL_NAME_FROM')
|
|
29
36
|
|
|
30
37
|
def send_mail(self, email_to: list, subject: str, language='NL', content: Optional[str] = None, attachment: Optional[BinaryIO | List[BinaryIO]] = None, cc: Optional[List | str] = None) -> List[dict]:
|
|
31
38
|
"""
|
{brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/requires.txt
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
brynq-sdk-brynq
|
|
1
|
+
brynq-sdk-brynq<5,>=4
|
|
2
2
|
mandrill-really-maintained<=2,>=1
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_mandrill',
|
|
5
|
-
version='
|
|
5
|
+
version='3.0.0',
|
|
6
6
|
description='Mandrill wrapper from BrynQ',
|
|
7
7
|
long_description='Mandrill wrapper from BrynQ',
|
|
8
8
|
author='BrynQ',
|
|
@@ -11,7 +11,7 @@ setup(
|
|
|
11
11
|
package_data={'brynq_sdk_mandrill': ['templates/*']},
|
|
12
12
|
license='BrynQ License',
|
|
13
13
|
install_requires=[
|
|
14
|
-
'brynq-sdk-brynq>=
|
|
14
|
+
'brynq-sdk-brynq>=4,<5',
|
|
15
15
|
'mandrill-really-maintained>=1,<=2'
|
|
16
16
|
],
|
|
17
17
|
zip_safe=False,
|
|
File without changes
|
{brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill/templates/mail_brynq.html
RENAMED
|
File without changes
|
{brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{brynq_sdk_mandrill-2.0.1 → brynq_sdk_mandrill-3.0.0}/brynq_sdk_mandrill.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|