Forums

Run python script .py at onClick() event on website

Hey guys, i need some help.

I made a web dinamic webscrapping (to make every information from a website like amazon and others). I used selenium and beautifulSoup4, and now i want to make a website for my application.

1) I created on a MacOs system using selenium.Safari(), but i need to run this code at every computer that have access to my website, is someone knows how to make it ?

2) So, how can i associate an action onClick() from a button inside my html file to a scrappingScript.py ?

thanks everyone !!

1) You can run Selenium scripts on PythonAnywhere, but you'd need to use the version of Firefox we have installed, which unfortunately is quite old -- version 17 -- because newer versions aren't compatible with our virtualization system. There are some hints and tips on how to do that on this help page.

2) You'd want to create a website, then have JavaScript call a view inside that website using AJAX (eg. over JQuery) that triggered the scraping script.