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:

Walking around in Ranikhet and Majkhali

In every walk with nature one receives far more than he seeks... The COVID restrictions were lifted and the itch to travel had started ye...… Continue reading

Python GUI Development: Tkinter

Published on June 23, 2021

Remote Office for Maximum Productivity

Published on June 22, 2021