GithubHelp home page GithubHelp logo

wynum-python's Introduction

Installation

pip install wynum

To install using github try

pip install -U -e git+https://github.com/wynum/wynum-python#egg=wynum

Getting started

Very easy to use. Create a Client and you're ready to go.

API Credentials

The Client needs Wynum credentials.You can either pass these directly to the constructor.

from wynum import Client

secret = "your_secret_key"
token = "project_token"
client = Client(secret, token)

Get schema

call getschema on Client to get the keys and types for the data. This will return a list of Schema objects. Schema.key will return the key and Schema.type will return the Wynum type. Following is the mapping from Wynum type to python type.

Wynum type Python type
Text str
Date str (dd/mm/yyyy)
Number int or float
Choice (Or) int or float
Multiple Choice (And) list of str
Time str (hh:mm)
File File
schemas = client.getschema()
for schema in schemas:
    print(schema.key, schema.type)

Post data

the postdata method accepts a single parameter data which is dict containing the post key:value. Every data dict should contain the 'identifier'. You can get identifier key if you have called getschema. You can retrieve it using client.identifier.

client.getschema()
identifer_key = client.identifier
data = {'key1':val1, 'key2':val2, identifer_key:'id_string'}
res = client.postdata(data)

If the call is successful it returns the dict containing the created data instance. If there is some error the dict will contain _error and _message keys. You should check this to check for errors.

Get data

Call getdata to get the data. This will return list of dict. getdata accepts following keyword arguments

  • limit: int
    Number of records to return.
  • order_by: str
    Sorting order which can either be 'asc' or desc'
  • ids: list of str
    The list of ids to retrieve
  • start: int
    Record number to start from
  • to: int
    Record number to end at

start and to can be used for pagination.

If no arguments are provided it will return the list of all data records.

data = client.getdata()

Updating data

The update method is same as that of postdata method.

client.getschema()
identifer_key = client.identifier
data = {'key1':val1, 'key2':val2, identifer_key:'id_string'}
res = client.update(data)

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.