pythonapp-inventor

Getting JSON from http://tinywebdb.appinventor.mit.edu


I am trying to get and store JSON data from http://tinywebdb.appinventor.mit.edu from python using requests. I am trying to have a common web DB for an android app and a desktop app.

I am trying to do something like this:

import requests
data = {"tag": "q1"}
r = requests.post('http://tinywebdb.appinventor.mit.edu/getvalue', params=data)

and then the code should return ["VALUE","q1","999999999"] but in JSON format

but it returns status_code 404

I am new to working with APIs so please help

Thanks


Solution

  • use data argument, not params:

    import requests
    data = {"tag":"q1"}
    r = requests.post('http://tinywebdb.appinventor.mit.edu/getvalue', data=data)
    print(r.json())
    

    output:

    ['VALUE', 'q1', '999999999']