简体   繁体   中英

Passing user input to python script and displaying results

I'm still learning Python and even more so, how to interact between Python and HTML. I'm trying to pass user input to a python script located on the server that utilizes an API and then return results to the user on the webpage. So far this is where I'm stuck at (aka the beginning).

<input type="text" id="fileName" name="fileName" placeholder="File Name" required></input>
<button type"submit" value="Submit" onclick="runPython"></button>

Here I'm still need Java/JQuery to interact with the Python script located in /environments/threatcrowd.py. And below is the Python script to interact with the API to pull results from ThreatCrowd.

#!/usr/bin/python
import requests, json
result = requests.get("http://www.threadcrowd.org/searchApi/v2/domain/report/", params = {"domain": "facebook.com"})
print(result.text)

I'm Highly recommend you to use Flask or Django. it is very simple and useful. https://flask.palletsprojects.com/en/1.1.x/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM