sean
Sure.
It's basically a copy/paste of what's above and then run through a prettifier to fix any spacing errors introduced by this forum's code formatter.
from requests.auth import AuthBase
import requests
TOKEN = "API_KEY_HERE"
class TokenAuth(AuthBase):
"""Attaches HTTP Token Authentication to the given Request object."""
def __init__(self, token):
# setup any auth-related data here
self.token = token
def __call__(self, r):
# modify and return the request
r.headers["Authorization"] = f"Token {self.token}"
r.headers["Content-Type"] = "application/json"
return r
r = requests.post(
f"https://my.opalstack.com/api/v0/mail/add/",
auth=TokenAuth(TOKEN),
data={
"source": "test@MY_DOMAIN.com",
"destinations": [],
"forwards": ["fwd-test-1@MY_DOMAIN.com", "fwd-test-2@MY_DOMAIN.com"],
},
)
I've tried destination
as above, commented out (via #
), with literally UUID
, and deleted all together.
None of those throw an error.
Thanks.