Code Monkey home page Code Monkey logo

lib-python's Introduction

StdLib Python Bindings

StdLib Setup | Node | Python | Ruby | Web

Basic Python bindings for StdLib service accession. Python 2.x and 3.x supported.

Used to interface with services built using StdLib and the StdLib Command Line Tools.

The lib package is available on PyPI: lib and operates as zero-dependency interface to run StdLib functions. This means that you can utilize any service on StdLib without installing any additional dependencies, and when you've deployed services to StdLib, you have a pre-built Python SDK --- for example;

from lib import lib

try:
    result = lib.yourUsername.hostStatus(name='Dolores Abernathy')
except RuntimeError as err:
    # handle error

To discover StdLib services, visit https://stdlib.com/search. To build a service, get started with the StdLib CLI tools.

Installation

To install in an existing Python project;

$ pip install lib

Usage

from lib import lib

# [1]: Call "utils.reflect" function, the latest version, from StdLib
result = lib.utils.reflect(key='value')
result = lib.utils.reflect({'key': 'value'}) # also works
result = lib.utils.reflect('value') # also works, if first parameter is "key"

# [2]: Call "utils.reflect" function from StdLib, with "dev" environment
result = lib.utils.reflect['@dev'](key='value')

# [3]: Call "utils.reflect" function from StdLib, with "release" environment
#      This is equivalent to (1)
result = lib.utils.reflect['@release'](key='value')

# [4]: Call "utils.reflect" function from StdLib, with specific version
#      This is equivalent to (1)
result = lib.utils.reflect['@0.0.1'](key='value')

# [5]: Call functions within the service (not just the defaultFunction)
#      This is equivalent to (1) when "main" is the default function
result = lib.utils.reflect.main(key='value')

# Valid string composition from first object property only:
result = lib['utils.reflect'](key='value')
result = lib['utils.reflect[@dev]'](key='value')
result = lib['utils.reflect[@release]'](key='value')
result = lib['utils.reflect[@0.0.1]'](key='value')
result = lib['utils.reflect.main'](key='value')
result = lib['utils.reflect[@dev].main'](key='value')
result = lib['utils.reflect[@release].main'](key='value')
result = lib['utils.reflect[@0.0.1].main'](key='value')

Sending File Data

In order to send file parameters, in Python 2.7 or 3.6, simply use;

lib.username.service(parameter=open('/path/to/file.jpg'))

Where parameter is the parameter name expecting a file type (type "buffer" as listed on StdLib).

Additional Information

To learn more about StdLib, visit stdlib.com or read the StdLib CLI documentation on GitHub.

You can follow the development team on Twitter, @StdLibHQ

StdLib is © 2016 - 2017 Polybit Inc.

lib-python's People

Contributors

keithwhor avatar

Watchers

James Cloos avatar

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.