I need help with combining ssmtp on both python and Sudo nano for my Raspberry Pi 4 Model B, as I have setup the ssmtp for Raspberry Pi with the codes below:
sudo apt-get install ssmtp
sudo nano /etc/ssmtp/ssmtp.conf
root=postman
mailhub=smpt.gmail.com:587
AuthUser=youremail@gmail.com
AuthPass=youremailpassword
FromLineOverride=YES
UseSTARTTLS=YES
But how can I combine with the nano openalpr_ocr.py, which is the codes below:
import requests
import base64
import json
def ocr(IMAGE_PATH):
SECRET_KEY = 'Add the secret key'
with open(IMAGE_PATH, 'rb') as image_file:
img_base64 = base64.b64encode(image_file.read())
url = 'https://api.openalpr.com/v2/recognize_bytes?recognize_vehicle=1&country=ind&secret_key=%s' % (SECRET_KEY) #Replace 'ind' with your country code
r = requests.post(url, data = img_base64)
try:
return(r.json()['results'][0]['plate'])
except:
print("No number plate found")
And How may I add the ssmtp function to the python code above?