I'm creating a web app in Python/Flask to display tweets using twitters API using tweepy. I have set up an HTML form, and have got the script that finds the tweets with a certain input, currently, this is hard coded. I want the users to input a hashtag or similar, and then on submit, the script to run, with that as its parameter
I've created a form, with method GET and action is to run the script.
<form class="userinput" method="GET" action="Tweepy.py">
<input type="text" placeholder="Search..">
<button type="submit"></button>
</form>
I dont know how I would get the users input and store it in a variable to use for the tweepy code, any help would be greatly appreciated
action="Tweepy.py"you do not seem to grasp how HTML forms work. You need to have a webserver that renders the HTML page with the form, then submit the form's content back to the server (preferably usingPOST, notGET) to a predefined route in your flask app. Flask even has a built-in way to achieve this (which is probably an overkill but it's a good place to start: flask.pocoo.org/docs/1.0/patterns/wtforms)