This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
def sendSlackMessage(message): | |
webhook_url = 'here is your webhook_url' | |
slack_data = {"text": "{}".format(message), "username": "your app name"} | |
response = requests.post(webhook_url, data=json.dumps(slack_data), | |
headers={'Content-Type': 'application/json'}) | |
if response.status_code != 200: | |
raise ValueError('Request to slack returned an error %s, the response is:\n%s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import requests | |
import urllib.parse | |
def sendTelegramMessage(message): | |
bot_token = 'API Token here' | |
bot_chatID = 'Chat ID here' | |
message = urllib.parse.query(message) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib.parse | |
import xmltodict | |
import requests | |
def send_sms(to_phone, message): | |
voip_server = "voipmove.com" # or any other Dellmont servers (find them on MobileVoip.com) | |
my_username = "my_username" | |
my_password = "my_password" | |
from_phone = "from_phone_number" # if a caller ID is already set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yagmail | |
def sendGMail(email): | |
user = 'your_username@gmail.com' | |
app_password = 'your_app_password' | |
to = email | |
subject = 'test subject 1' | |
content = ['mail body content'] | |
with yagmail.SMTP(user, app_password) as yag: | |
yag.send(to, subject, content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
def sendEmail(name, email, filename='message.txt'): | |
# open a template file | |
with open(filename, 'r', encoding='utf-8') as template_file: | |
template_file_content = template_file.read() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Country | Predicted | Actual | Difference | |
---|---|---|---|---|
France | 4 | 1 | 3 | |
Croatia | 9 | 2 | 7 | |
Belgium | 5 | 3 | 2 | |
England | 7 | 4 | 3 | |
Russia | 25 | 5 | 20 | |
Brazil | 3 | 6 | -3 | |
Uruguay | 13 | 7 | 6 | |
Sweden | 14 | 8 | 6 | |
Spain | 1 | 9 | -8 |