How to send http request to python flask server from desktop application? -


I have configured the Python server using the Flask Framework. Now I want to send a request to the server from my desktop application. My server location is: http://127.0.0.1.000/

I wrote that works from the browser but I want to access that code from my desktop app I am / P>

  import flask, flask. Import Video Import OS functools app = flask.flask (__name__) app.secret_key = "xyz" user = {'pravin': 'ABC'} class main (flask.views.MethodView): def find (auto): Return Flask.render_template ('index.html') DEF Post (self): If 'logout' in 'flask.request.form': flask .session.pop ('username', none) return flask.redirect (flask. Url_for ('index')) = = '[Username', 'passwd]' is required for R: if not in flask.request.form: flask.flash ("Error: {0} is required." Format (R)) return flask.redirect (flask.url_for ('index')) username = flas K.request.form ['username'] password = flask .request.form ['passwd'] if user and user [user name] == username in the password: flask.session ['username'] = user name other: Flask.flash ("Username does not exist or is not a wrong password.") Return flask.redirect (fl app.add_url_rule ("/", view_func = main.as_view ("index"), methods = ["received" "Post"]) app.debug = true app.run ()    

Using a python library to access the URL from the app Interpretation will.

Try it makes it easy to work with HTTP requests and describes itself as an elegant and simple HTTP library for Python, designed for humans.

Sample code:

  & gt; & Gt; & Gt; R = requests.get ('http://127.0.0.1.000') & gt; & Gt; & Gt; R.status_code & lt; Feedback [200] & gt;    

Comments