Learn Python by Creating Webapps

Reading time ~1 minute

Main Course Link

This Series is a part of 30 Days of Learning.

  • Using Beautiful Soup to Parse Website Data
import requests
from bs4 import BeautifulSoup, element

request = requests.get("https://www.packtpub.com/product/complete-python-web-course-build-8-python-web-applications-video/9781839215094")
# <span class="price-list__price" itemprop="price" content="6823.99"> ₹6,823.99  </span>
content = request.content
soup = BeautifulSoup(content, "html.parser")
element = soup.find("span", attrs={"itemprop": "price", "class": "price-list__price"})
print (element.text.strip())
  • Using MongoDB with python
from pymongo import MongoClient

client = MongoClient('localhost', 27018)
database = client["yogesh"]
print (database.list_collection_names())
collection = database["posts"]

# Inserts
post = {"name": "Yogesh", "age": 29}
post_id = collection.insert_one(post).inserted_id
 
# Retrieval
usrs = collection.find({})
for user in usrs:
    print(user)
  • Inserting a new item
    • db.posts.insert({ JSON DATA)})
  • Removing items from mongo
    • b.posts.remove({})

With the help of this course I create a personal blog site using Flask, MongoDB, Jinja2, HTML/CSS, Bootstrap. There is a lot that is to be done in this yet but it serves as a good skeleton for starting a web project.

Github Link : (https://github.com/yogeshmpandey/FlaskBlog) [https://github.com/yogeshmpandey/FlaskBlog]

A Brief demo of the App:

PhotoBlog - Kumaoni Temples

“Travel is the only thing you buy that makes you richer” This is a trip, that I had planned a long back and quite meticulosly. We planned...… Continue reading

My First 10K run

Published on August 17, 2021

Walking around in Ranikhet and Majkhali

Published on July 04, 2021