My very simple flask application:
@app.route("/login",methods=["POST"])
def login():
if request.method=="POST":
username=request.form["username"]
if not username:
return redirect(url_for("index"))
else:
url="https://www.instagram.com/"+username+"/?__a=1"
response=requests.get(url, headers={ 'User-Agent':request.headers.get("User-Agent"),'Content-Type':'application/json; charset=utf-8'})
json=response.json()
img=json["graphql"]["user"]["profile_pic_url_hd"]
log_user(username)
return render_template("login.html",username=username,img=img)
return render_template("login.html",username=username)
But I don't understand ** json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ** I get this error.
Actually the code works fine on localhost but when I deploy to Heroku I get an error.
Please help me.
Aucun commentaire:
Enregistrer un commentaire