Giter Club home page Giter Club logo

supplai-client's Introduction

Supplai REST API Client

PyPI latest PyPI Version PyPI License Travis Build Status Coverage Status

OVERVIEW

Supplai Client is a python3 wrapper for Supplai's REST API v1. This library currently implements the features released under version 0.100.1 of Supplai's REST API.

Requirements

This project requires:

  • Python 3.4 or earlier
  • git client
  • virtualenvwrapper/virtualenv for local development

Installation

$ pip install [email protected]:supplai/supplai-client.git

Or, you can download the source and

$ git clone [email protected]:supplai/supplai-client.git

$ cd supplai_client
$ python setup.py install

USAGE

  1. Request to the Supplai Admin team to a API Access Token.
  2. Import the supplai_client module and create an instance with your access token:
>> from supplai_client import API
>> from supplai_client.exceptions import SupplaiError
>>
>> access_token = "<Supplai Access token>"
>> client = API(environment="practice", access_token=access_token)

>> try:
>>     result = client.user.get_users()
>> # In case of http status 400
>> except SupplaiError as exc:
>>     print(str(exc))
>>
>> # Use the result as object
>> print(result.as_obj())
UserUsers(
    previous=None,
    count=1,
    next=None,
    results=[
        NamelessModel(occupation=None, full_name='Admin System',
            image=None, cpf='', is_superuser=True, cellphone='', email='', sex=None, username='admin', birthdate='09/09/1999',
            logged_as='', id=1, is_temp=False, is_active=True)
    ]
)
>>
>> # Use the result as dict
>> print(result.as_dict())
{'count': 1,
 'next': None,
 'previous': None,
 'results': [{'id': 1,
   'username': 'admin',
   'full_name': 'Admin System',
   'sex': None,
   'birthdate': '09/09/1999',
   'cpf': '',
   'cellphone': '',
   'email': '',
   'image': None,
   'occupation': None,
   'logged_as': '',
   'is_superuser': True,
   'is_active': True,
   'is_temp': False}
  ]
 }

Contributing

Please send pull requests, very much appreciated.

  1. Fork the repository on BitBucket.
  2. Create a virtualenv.
  3. Install requirements. pip install -r requirements-dev.txt
  4. Install pre-commit. pre-commit install
  5. Make a branch off of master and commit your changes to it.
  6. Create a Pull Request with your contribution

NOTES

  • Supplai API REST Client is still under development, some functionality have not yet been implemented, but I will keep an eye on it, and as soon as it gets implemented I will update this library accordingly.

supplai-client's People

Contributors

rhenter avatar

Watchers

 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.