0

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

psycoxer
  • 151
  • 13

2 Answers2

2

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']

buran
  • 13,682
  • 10
  • 36
  • 61
1

From Post JSON using Python Requests

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

gives me

["VALUE",null,""]