Coder Social home page Coder Social logo

backendless-python's Introduction

Backendless-Python

Python wrapper for Backendless MBaaS REST API

Dependencies: Requests

This currently only includes very basic functionality (registration, login, updating user fields, logging out).

Any/all pull requests are welcome.

Usage

import PyBackendless

APP_ID = "EXAMPLE-ID-E763-ID00-FF7C-AAEFC5DC2100"
REST_KEY = "REST-API-KEY-FFBB-F3C7E118B900"

backendless = PyBackendless.Backendless(APP_ID, REST_KEY)
# Optional parameters + Default values:
  # time_out = 30 # requests connection timeout. Returns {'error':'CONNECTION_TIMEOUT'}
  # verbose = True # prints error exceptions to console

# IMPORTANT: integers/floats in string table objects must be input as such in the payload dictionaries
# json.dumps() does not make this conversion, and backendless will issue a 400 response to non-strings
# If your user identity is the 'name' variable, payload would be {'name':'guy','password':'123456'}
response = backendless.register_user({"email":"[email protected]","password":"123456"}
print response

# The "login" key is mandatory, its value is whatever the 'identity' field of your application is set to
response = backendless.login_user({'login':'[email protected]','password':'123456'})
print response

# Updating a user object 
response = backendless.update_user_object({'name':'guy'})
print response

# Write user-token and info to serialized object
response = backendless.create_token(fileName = "userToken.p")
print response # True or False

# Load user token and re-validate login
del backendless # delete object and reinitialize
backendless = PyBackendless.Backendless(APP_ID, REST_KEY)
response = backendless.read_token("userToken.p")
print response # Same return as initial log-in response
ret = backendless.validate_session() # Check if user-token is still valid
print ret

# if token is still active, renew it with a user-object update
response = backendless.update_user_object({})
print response

# Logging out
response = backendless.logout()
print response

backendless-python's People

Contributors

blakebjorn avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jesteroc3 okano

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.