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 subprocess | |
from bs4 import BeautifulSoup | |
import requests | |
import time | |
while True: | |
url = "http://static.cricinfo.com/rss/livescores.xml" | |
r = requests.get(url) | |
soup = BeautifulSoup(r.text, "html.parser") | |
data = soup.find_all("description") |
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
<link rel="stylesheet" | |
href="https://fonts.googleapis.com/css?family=Baloo+Bhai" /> | |
<style> | |
.alignleft { | |
float: left; | |
} | |
.alignright { | |
float: right; | |
} | |
</style> |
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
from flask import Flask | |
from flask_mail import Mail, Message | |
app = Flask(__name__) | |
mail = Mail(app) | |
app.config['MAIL_SERVER'] = 'smtp.gmail.com' | |
app.config['MAIL_PORT'] = 465 | |
app.config['MAIL_USERNAME'] = 'yourmail@mail.com' | |
app.config['MAIL_PASSWORD'] = 'yourpassword' |
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
class Book(db.model): | |
__tablename__='books' | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String()), | |
author = db.Column(db.String()), | |
published = db.Column(db.String()), |
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
book = Book(name="The monk who sold his ferrari", author="Robin Sharma", published="1997-03-04") | |
db.session.add(book) | |
db.session.commit() |
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
db.session.delete(book) | |
db.session.commit() |
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
author = Author.objects.get(pk=author.pk) | |
reporter.refresh_from_db() |
OlderNewer