You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By running this code, you will see similar debug info in your terminal:
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 740-075-329
The decorator above the home() function indicates that this function occurs when navigating to root in your web browser.
Using the same path in Postman shows simply the text string that we returned.
I created an additional function called get_movie() with the following decorator.
@app.route("/get-movie/<movie_title>")defget_movie(movie_title):
url=f"https://yts.mx/browse-movies/{movie_title}/all/all/0/latest/0/all"r=requests.get(url=url)
soup=BeautifulSoup(r.text, 'html.parser')
responses=get_page_links(soup)
print(type(responses))
status_code=200# check to make sure something was returnedifresponses== {}:
status_code=204returnresponses, status_code