best way for python to interface with MySQL
<p>I'm still very new to programming and trying to teach myself the correct ways of doing things. </p>

<p>I'm currently writing a script that will take 1-3 values, generated about every second, within python and then save it to a MySQL database. Down the road will build a web interface that will take those values and nicely display them, but for now I just want to save the data. </p>

<p>I will be running the Python code on a Raspberry Pi, and hopefully the web server with the MySQL server. If not on that device on another Raspberry Pi. </p>

<p>What I'm here asking is, what is the best way for Python to work with MySQL? Library or HTTP GET, or another way I don't know about... Since, I was going to build a web interface, I was thinking about having an API.php page that will take GET request and then the PHP code will write the data to the MySQL database.  </p>

<p>What I had in mind was to have Python generate a link then use the request library to request the site e.g <a href="http://127.0.0.1/API.php?value1=XXX&amp;Value2=YYY&amp;value3=ZZZ" rel="noreferrer">http://127.0.0.1/API.php?value1=XXX&amp;Value2=YYY&amp;value3=ZZZ</a>  then wait for a JSON return of something like "Data Saved" if the data was saved correctly. Then continue the loop of generating the next value. </p>

<p>What that be the best way of going about this or is there a better way? I know that I will have some security issues, and I hope to resolve them once I learn more about coding. And remember that I want the data written every 1 or 5 seconds. Hopefully, every 1 second. </p>

<p>Thank you guys for your responses,
Throdne</p>