I am planning to use Backendless to store and retrieve data with Python. I have searched and searched and have not been able to find any documentation on Python support. Could you please point me in the right direction?
Hi Eric,
We do not have a native Python SDK, that leaves you with 2 options:
- Using REST methods, which give you a pretty much complete support for everything Backendless does. The REST documentation is here: http://backendless.com/documentation/users/rest/users_overview.htm
Using [url=http://py4j.sourceforge.net/index.html]PY4J[/url] and the Backendless SDK for Java/Android. It would look something like this:
>>> from py4j.java_gateway import JavaGateway
>>> gateway = JavaGateway() # connect to the JVM
>>> dataStore = gateway.jvm.Backendless.Data.of( gateway.jvm.com.foo.Person.class );
>>> collectionOfPerson = dataStore.find()
I personally have not tried that approach and not sure how well it would work.
Regards,
Mark
I’m writing Python scripts using requests agains the REST endpoint directly. It’s very hard! I wish someone wrote something official.
This code is working for Python
Graba Datos-Backendless
import json,httplib
connection = httplib.HTTPSConnection('api.backendless.com', 443)
connection.connect()
connection.request('POST', '/v1/data/Goles', json.dumps({
"gol_de": golde,
"jugador": jugador,
"resultado": resultado,
"local": flagEquipoLocal,
"visitante": flagEquipoVisitante,
"categoria": flagCategoria,
"notifyStatus": resultNotiBack
}), {"application-id": applicationidback,
"secret-key": secretkeyback,
"Content-Type": "application/json"})
result = json.loads(connection.getresponse().read())
print('Graba Goles-BackEndless:')
print(result)
1 Like