import smtplib
fromaddr = 'FROM'
toaddr = 'TO'
subj = 'Test email'
msg_txt = bytes('body','utf-8')
msg = "From: %s\nTo: %s\nSubject: %s\n\n%s" % (fromaddr, toaddr, subj, msg_txt)
username = 'username'
password = 'password'
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username, password)
server.sendmail(fromaddr, toaddr, msg)
server.quit()
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import urllib.request
from lxml import etree
url = 'http://myip.ru/'
query = '//*/table[@class="network-info"]'
parser = etree.HTMLParser()
req = urllib.request.urlopen(url)
tree = etree.parse(req, parser)
tbl = tree.xpath(query)
print(tbl[0][1][0].text)
curl https://api.pushbullet.com/api/pushes \
-u $API_KEY: \
-d device_iden=$DEV_ID \
-d type=note \
-d title="Заголовок" \
-d body="Тело сообщения" \
-X POST