Giter VIP home page Giter VIP logo

pyrest's Introduction

pyrest

pyrest is a small RESTFul API Wrapper for python. It allows you to rapidly develop your own API Wrapper for your specific application, without worrying about the HTTP Requests on their own.

Code Examples

This would be a basic GET request

from pyrest.api import Api


stack = Api('http://api.stackexchange.com/2.1')  # Notice no trailing / !
stack.update_endpoints(
    {
        'ans': 'answers'
    }
)

print(
    stack.get(
        endpoint = 'ans',
        parameters = (('site', 'stackoverflow'), ('order', 'desc'))
    )
)

Here we show off some of our fancy url modularization:

stack = Api('http://api.stackexchange.com/2.1')  # Notice no trailing / !
stack.update_endpoints(
    {
        'comments': 'posts/%(id)s/comments'
    }
)
print(
    stack.get(
        endpoint = 'comments',
        parameters = (('site', 'stackoverflow'), ('order', 'desc')),
        url_data = {'id': '11867143'}
    )
)

Style/Commiting Guide

  • Commit early, commit often.
  • PEP8
  • At the top of any scope, initialize and define any methods you will use inside it. For objects, use None. For primitives, use the most empty value (False, 0, '', etc.)
    • Two spaces, and then a comment to describe what it does
    • BEWARE, dictionaries (and most likely many others collections!) are objects, and do not get re-instantiated between object instantiation. Make sure in init() you re-set them.
  • Run linters
    • pep8
    • pylint
    • pyflakes
    • pychecker
  • Code Coverage
    • Use coverage to test our code! 100% coverage is a nice rule of thumb.
      • coverage run --omit=tests.py --branch tests.py

Licensing

The code in this repository is underneath the GPLv3 license

pyrest's People

Contributors

travisby 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.