Your assigned language is: English
Classroom blog: googleclouduconn.blogspot.com
8/10/2021, 8:58 PM
I've updated the sendgrid documentation
need to import sendgrid from linux shell command line
pip3 install sendgrid
Left out the installation of the sendgrid libraries on your linux shell
https://uconnstamfordslp.blogspot.com/p/sendgrid-email.html
From the example
Once the web page is posted we can use other examples from code to get
the email process to work
E.g.
In the python CRUD example we use this code to retrieve all records
into an array
# Get Customer List
# retrieves all data with Kind custinfo
query = client.query(kind=kind)
# fetch method that retrieve all results that match query
results = list(query.fetch())
We can then loop thru the array with all records to get the email
address we wish to send and the language we want to send it in
Then we can use the translate code from that same CRUD example to
translate to comment box form the html form
tinst = customer['instructions']
tlang = 'es'
result = translate_client.translate(tinst, target_language=tlang)
# Render the page
# translate process should go here
from_email = Email("jiacovacci@hotmail.com") # Change to your
verified sender
to_email = To("john.iacovacci1@gmail.com") # Change to your
recipient from array item
subject = "Did this work?"
content = Content("text/plain", Comments) #translated comments
based on the clients stored language
mail = Mail(from_email, to_email, subject, content)
mail_json = mail.get()
# Send an HTTP POST request to /mail/send
response = sg.client.mail.send.post(request_body=mail_json)
print(response.status_code)
print(response.headers)
return render_template('comments.html', FormComments=Comments)
# Renders the page with the response
Make sure you keep the requirements.txt file updated with all libraries used
Flask>=1.1.1
google-cloud-datastore
Google-cloud-translate
PyYAML>=4.2b1
python-http-client>=3.2.1
six==1.11.0
pytest==3.8.2
starkbank-ecdsa>=1.0.0
sendgrid==v6.0.0
Subscribe to:
Post Comments (Atom)
Disable Billing
Search for Billing Manage billing accounts Go to MYPROJECTS CLICK ON THE 3 BUTTON Actions Then hit disable
-
Create a web site with main page of index.html and 2 other linked original content html pages At least 2 links to public web pages you di...
-
Assignment # 6 due 10/18/24 https://uconnstamfordslp.blogspot.com/p/assignment-exercise-python-datastore.html Recreate the app engine pr...
-
Your assigned language is: English Classroom blog: googleclouduconn.blogspot.com 8/31/2021, 8:08 PM Assignment 1 due 9/9/21 https...
No comments:
Post a Comment