can anyone solve this error #1136
Unanswered
TusharaPriya
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
from flask import Flask, redirect, url_for, render_template, request, flash
from flask import request
import csv
from bs4 import BeautifulSoup
from msedge.selenium_tools import Edge, EdgeOptions
import pandas as pd
import json
from bs4 import BeautifulSoup as bs
from urllib.request import urlopen as uReq
import time
from bs4 import BeautifulSoup
import requests
app = Flask(name)
@app.route("/", methods=["POST", "GET"])
def home():
if request.method == "POST":
test = []
names = []
flipPrices = []
prodNames = []
info,price = [],[]
url = "https://flipkart.com/search?q="
q = request.form["nm"]
q = q.replace(" ","+")
# response recieved in bytes
resp = requests.get(url+q)
# parsing response content using BeautifulSoup class, so that we can perform operations on it.
parsed_html = bs(resp.content, 'html.parser')
# data cleaning
raw_data = parsed_html.find("script", attrs={"id":"is_script"})
data = raw_data.contents[0].replace("window.INITIAL_STATE = ","").replace(";","")
json_data = json.loads(data)
req_data = json_data["pageDataV4"]["page"]["data"]["10003"] #[10]["widget"]["data"]["products"][3]["productInfo"]
#req_json_data = json_data["seoMeta"]["answerBox"]["data"]["renderableComponents"][0]["value"]["data"]
@app.route('/stocks')
def Stocks():
key = "YO"
filename = 'flipkartandamazon.csv'
data = pd.read_csv(filename, header=0)
stocklist = list(data.values)
return render_template('stocks.html', stocklist=stocklist, key = key)
@app.route("/")
def user(usr):
if name == "main":
from waitress import serve
serve(app,host="0.0.0.0",port=8080)
app.run(debug=True)
error:
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
INFO:werkzeug: * Restarting with windowsapi reloader
An exception has occurred, use %tb to see the full traceback.
SystemExit: 1
Beta Was this translation helpful? Give feedback.
All reactions