#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0

    Python get data from external MYSQL


    I have a website running with users and infromation about them.

    PHP + MYSQL

    I can not connect directly to the MYSQL from external locations. (Server in datacenter / python script on mobile device)

    What I need to do is the following:

    1. Get username and information from the database using the Python script.
    2. Send data back to the MYSQL

    The second part can be done by opening a page like:

    data.php?user_id=111&value=250

    Only before I can send the user id i have to get it in the python script. And at this part i'm getting lost.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    144
    Rep Power
    4
    So, it sounds to me like what you really need to write here is a web service with which your Python script can communicate. Nowadays this is usually done by implementing a RESTful service on the web server side, and interchanging JSON formatted data using standard HTTP requests.

    On the python side, you probably want to look into using the requests library to make your http requests to the server.

IMN logo majestic logo threadwatch logo seochat tools logo