The following is a Python function to send data to Datagran via the REST API integration.
Python code
import requests
# 6357fa411b2ba17da22bfdee is an integration in one of our development workspaces.
# It has a single stream named "test". This stream has A SINGLE COLUMN named "Numeric".
requests.post(
url="<https://api.v2.datagran.io/v2/integrations/6357fa411b2ba17da22bfdee/push_data/test>",
headers={"Authorization": "75629Oi_K7d9ce1aeHMrOebJ08gl8c67berff8685PDc2f58W3l08ytaa1Ue3O48dE4k5b65K19df6cyRe2cJ4fufGrb022I341Zaedd950"},
files={'data-file': open('myfile.json','rb')}
)
# This, considering the contents of 'myfile.json' look like this:
{
"cols": ["Numeric"],
"rows": [
[1],
[1],
[2],
[3],
[5],
[8],
[13],
]
}
Note: Remember that for files larger than 10MB you will need to send multiple requests.