Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sunpriya/db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import constants as constants
from pymongo import MongoClient
from exception import CSSException
import requests

client=MongoClient()

db=client[constants.DB_NAME]

email_id_col=db[constants.EMAIL_ID_COLLECTION]
def get_email_id():

resp = email_id_col.find_one()
if resp is not None:
def send_email():
return requests.post(
"https://api.mailgun.net/v3/samples.mailgun.org/messages",
auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
data={"from": "Excited User <excited@samples.mailgun.org>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data object should actually come from the body of a POST.

"to": ["devs@mailgun.net"],
"subject": "Hello",
"text": "Testing some Mailgun awesomeness!",
"o:tracking":True})
raise CSSException(501, constants.RESPONSE_MESSAGE_NOT_IMPLEMENTED)