Hello,
Is it possible to call the dash application with HTTP requests?
I have application app1
under the link: http://127.0.0.1:8050/app1
.
I tried to call this url
with python requests module:
import requests
import json
payload = {'download': True}
def make_request():
url = "http://127.0.0.1:8050/app1"
r = requests.get(url, data=json.dumps(payload))
print(r.request.__dict__)
When my server is running and I do make_request()
then in my response I get all content with HTML that contains my app and in response to request I can see that my data was properly send in body:
{'_body_position': None,
'_cookies': <RequestsCookieJar[]>,
'body': '{"download": true}',
'headers': {'User-Agent': 'python-requests/2.26.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '18'},
'hooks': {'response': []},
'method': 'GET',
'url': 'http://127.0.0.1:8050/app1'}
But on the server-side, I can’t see that the user called app1 endpoint to get requests. I tried to print in my app (flask.request) but it doesn’t print anything like it doesn’t call this endpoint on the server.
Is it somehow possible to make get requests from the outside
and get this information inside server? Because if I just go to webbrowser and pass there ‘http://127.0.0.1:8050/app1’ I see in server flask.request.