novamail 0.1.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.
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: novamail
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the NovaMail API
5
+ Author-email: NovaMail API <support@novamail.app>
6
+ Project-URL: Homepage, https://novamail.app
7
+ Project-URL: Source Code, https://github.com/yourusername/novamail-python
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+
15
+ # NovaMail Python SDK
16
+
17
+ The official Python library for the NovaMail API. Easily integrate transactional emails into your Python applications.
18
+
19
+ ## Installation
20
+
21
+ You can install the package directly via `pip`:
22
+
23
+ ```bash
24
+ pip install novamail
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Create an API key in your NovaMail dashboard and use it to initialize the client.
30
+
31
+ ```python
32
+ from novamail import NovaMailClient
33
+
34
+ # Initialize the client with your API key
35
+ client = NovaMailClient(api_key="nm_live_your_api_key_here")
36
+
37
+ # Send an email
38
+ response = client.send_email(
39
+ to="recipient@example.com",
40
+ from_email="sender@your-verified-domain.com",
41
+ subject="Welcome to NovaMail",
42
+ html="<h1>Hello!</h1><p>This is a test email sent from the Python SDK.</p>"
43
+ )
44
+
45
+ print("Email sent successfully!")
46
+ print(response)
47
+ ```
48
+
49
+ ## Advanced Usage
50
+
51
+ If you need to point the SDK to a different base URL (for example, for local testing), you can pass it to the client:
52
+
53
+ ```python
54
+ client = NovaMailClient(
55
+ api_key="nm_test_...",
56
+ base_url="http://localhost:54321/functions/v1"
57
+ )
58
+ ```
@@ -0,0 +1,44 @@
1
+ # NovaMail Python SDK
2
+
3
+ The official Python library for the NovaMail API. Easily integrate transactional emails into your Python applications.
4
+
5
+ ## Installation
6
+
7
+ You can install the package directly via `pip`:
8
+
9
+ ```bash
10
+ pip install novamail
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Create an API key in your NovaMail dashboard and use it to initialize the client.
16
+
17
+ ```python
18
+ from novamail import NovaMailClient
19
+
20
+ # Initialize the client with your API key
21
+ client = NovaMailClient(api_key="nm_live_your_api_key_here")
22
+
23
+ # Send an email
24
+ response = client.send_email(
25
+ to="recipient@example.com",
26
+ from_email="sender@your-verified-domain.com",
27
+ subject="Welcome to NovaMail",
28
+ html="<h1>Hello!</h1><p>This is a test email sent from the Python SDK.</p>"
29
+ )
30
+
31
+ print("Email sent successfully!")
32
+ print(response)
33
+ ```
34
+
35
+ ## Advanced Usage
36
+
37
+ If you need to point the SDK to a different base URL (for example, for local testing), you can pass it to the client:
38
+
39
+ ```python
40
+ client = NovaMailClient(
41
+ api_key="nm_test_...",
42
+ base_url="http://localhost:54321/functions/v1"
43
+ )
44
+ ```
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "novamail"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="NovaMail API", email="support@novamail.app" },
10
+ ]
11
+ description = "Official Python SDK for the NovaMail API"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = [
20
+ "requests>=2.25.0",
21
+ ]
22
+
23
+ [project.urls]
24
+ "Homepage" = "https://novamail.app"
25
+ "Source Code" = "https://github.com/yourusername/novamail-python"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .client import NovaMailClient
2
+
3
+ __all__ = ["NovaMailClient"]
@@ -0,0 +1,62 @@
1
+ import requests
2
+ from typing import Optional, Union, List
3
+
4
+ class NovaMailClient:
5
+ def __init__(self, api_key: str, base_url: str = "https://api.novamail.app/v1"):
6
+ """
7
+ Initialize the NovaMail API client.
8
+
9
+ :param api_key: Your NovaMail API Key
10
+ :param base_url: The base URL of the NovaMail API (defaults to https://api.novamail.app/v1)
11
+ """
12
+ self.api_key = api_key
13
+ self.base_url = base_url.rstrip('/')
14
+
15
+ def send_email(
16
+ self,
17
+ to: Union[str, List[str]],
18
+ from_email: str,
19
+ subject: str,
20
+ html: Optional[str] = None,
21
+ text: Optional[str] = None
22
+ ):
23
+ """
24
+ Send an email using NovaMail.
25
+
26
+ :param to: Recipient email address or list of addresses
27
+ :param from_email: Sender email address (must be a verified domain)
28
+ :param subject: Email subject
29
+ :param html: HTML content of the email
30
+ :param text: Plain text content of the email (used as fallback if html not provided, though the API expects HTML currently)
31
+ :return: JSON response from the API
32
+ """
33
+ if not html and not text:
34
+ raise ValueError("You must provide either 'html' or 'text' content for the email.")
35
+
36
+ url = f"{self.base_url}/email"
37
+
38
+ headers = {
39
+ "Authorization": f"Bearer {self.api_key}",
40
+ "Content-Type": "application/json"
41
+ }
42
+
43
+ payload = {
44
+ "to": to,
45
+ "from": from_email,
46
+ "subject": subject,
47
+ "html": html or text or ""
48
+ }
49
+
50
+ response = requests.post(url, json=payload, headers=headers)
51
+
52
+ try:
53
+ response.raise_for_status()
54
+ except requests.exceptions.HTTPError as e:
55
+ # Try to get more descriptive error from JSON response
56
+ try:
57
+ error_data = response.json()
58
+ raise requests.exceptions.HTTPError(f"{e} - API Error: {error_data}", response=response)
59
+ except ValueError:
60
+ raise e
61
+
62
+ return response.json()
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: novamail
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the NovaMail API
5
+ Author-email: NovaMail API <support@novamail.app>
6
+ Project-URL: Homepage, https://novamail.app
7
+ Project-URL: Source Code, https://github.com/yourusername/novamail-python
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+
15
+ # NovaMail Python SDK
16
+
17
+ The official Python library for the NovaMail API. Easily integrate transactional emails into your Python applications.
18
+
19
+ ## Installation
20
+
21
+ You can install the package directly via `pip`:
22
+
23
+ ```bash
24
+ pip install novamail
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Create an API key in your NovaMail dashboard and use it to initialize the client.
30
+
31
+ ```python
32
+ from novamail import NovaMailClient
33
+
34
+ # Initialize the client with your API key
35
+ client = NovaMailClient(api_key="nm_live_your_api_key_here")
36
+
37
+ # Send an email
38
+ response = client.send_email(
39
+ to="recipient@example.com",
40
+ from_email="sender@your-verified-domain.com",
41
+ subject="Welcome to NovaMail",
42
+ html="<h1>Hello!</h1><p>This is a test email sent from the Python SDK.</p>"
43
+ )
44
+
45
+ print("Email sent successfully!")
46
+ print(response)
47
+ ```
48
+
49
+ ## Advanced Usage
50
+
51
+ If you need to point the SDK to a different base URL (for example, for local testing), you can pass it to the client:
52
+
53
+ ```python
54
+ client = NovaMailClient(
55
+ api_key="nm_test_...",
56
+ base_url="http://localhost:54321/functions/v1"
57
+ )
58
+ ```
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/novamail/__init__.py
4
+ src/novamail/client.py
5
+ src/novamail.egg-info/PKG-INFO
6
+ src/novamail.egg-info/SOURCES.txt
7
+ src/novamail.egg-info/dependency_links.txt
8
+ src/novamail.egg-info/requires.txt
9
+ src/novamail.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.25.0
@@ -0,0 +1 @@
1
+ novamail