Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
from API to ip
#8
(Dec-05-2018, 10:19 PM)whatl0ol Wrote: @app.route("/")
def main():
response = requests.get("API",auth=('user', 'pass'))
data = response.json()
return jsonify()
You're returning an empty json object. That last line should be return data or return jsonify(data) if you want to send it to the client.


(Dec-05-2018, 10:19 PM)whatl0ol Wrote: this code receive data from html form how receive data if user requests for example with curl or something?
Exactly the same way. Making a POST request is the same, whether it's from curl or javascript or html-forms. If you use curl to post to /, you should get the text.
Reply


Messages In This Thread
from API to ip - by whatl0ol - Dec-05-2018, 09:11 PM
RE: from API to ip - by nilamo - Dec-05-2018, 10:09 PM
RE: from API to ip - by whatl0ol - Dec-05-2018, 10:11 PM
RE: from API to ip - by nilamo - Dec-05-2018, 10:13 PM
RE: from API to ip - by whatl0ol - Dec-05-2018, 10:19 PM
RE: from API to ip - by nilamo - Dec-06-2018, 04:45 AM
RE: from API to ip - by whatl0ol - Dec-06-2018, 04:11 PM
RE: from API to ip - by nilamo - Dec-06-2018, 04:49 PM
RE: from API to ip - by whatl0ol - Dec-06-2018, 04:49 PM
RE: from API to ip - by nilamo - Dec-06-2018, 05:10 PM
RE: from API to ip - by snippsat - Dec-06-2018, 11:00 PM
html to python - by whatl0ol - Dec-06-2018, 12:36 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020