Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Postmark API library for python 2.7, 3.6 and pypy. Built on top of the requests library.
The full Sphinx-compiled documentation is available here: https://readthedocs.org/docs/pystmark/en/latest/
from pystmark import (
Message,
send,
send_with_template,
send_batch,
send_batch_with_templates,
UnauthorizedError
)
API_KEY = 'my_api_key'
SENDER = 'me@example.com'
# Send a single message
message = Message(
sender=SENDER,
to='you@example.com',
subject='Hi',
text='A message',
tag='greeting'
)
response = send(message, api_key=API_KEY)
# Send a template message
model = {
'user_name': 'John Smith',
'company': {
'name': 'ACME'
}
message = Message(
sender=SENDER,
to='you@example.com',
template_id=11111,
template_model=model,
tag='welcome',
)
response = send_with_template(message, api_key=API_KEY)
# Send multiple messages
messages = [
Message(
sender=SENDER,
to='you@example.com',
subject='Hi',
text='A message',
tag='greeting',
message_stream='broadcasts',
)
]
response = send_batch(messages, api_key=API_KEY)
# Send multiple messages with templates
messages = [
Message(
sender=SENDER,
to='you@example.com',
template_id=11111,
template_model=model,
tag='greeting',
message_stream='broadcasts',
)
]
response = send_batch_with_templates(messages, api_key=API_KEY)
# Check API response error
try:
response.raise_for_status()
except UnauthorizedError:
print 'Use your real API key'
# Check for errors in each message when sending batch emails:
for m in response.messages:
if m.error_code > 0:
print m.message
Please run the tests with ./setup.py test --with-integration
, with at least python2.7,
before you make a pull request. Requirements for running the tests are in tests/requirements.txt
.
The other versions will be handled by travis-ci.
The pep8 tests may fail if using pypy due to this bug, so that test is disabled if pypy is detected.
pystmark is licensed under the MIT license. See the LICENSE file for full details.
FAQs
A Python library for the Postmark API (http://developer.postmarkapp.com/).
We found that pystmark demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.