Git Product home page Git Product logo

nap's Introduction

nap

api access models and tools

Accessing APIs open-endily is an easy affair. pip install requests, pass in your data get data back. But the slight differences and demands of different API creating code that’s structured, re-usable and simple proves difficult.

nap hopes to help.

# note/client.py
from nap.resources import ResourceModel, Field


class Note(ResourceModel):

    pk = Field(api_name='id', resource_id=True)
    title = Field()
    content = Field()

    class Meta:
        root_url = 'http://127.0.0.1:8000/api/'
        resource_name = 'note'

n = Note(title='Some Title', content="some content")

# POST http://127.0.0.1:8000/api/note/
n.save()

n = Note.get('note/1/')
# Some Title
n.title

# GET http://127.0.0.1:8000/api/note/1/
n = Note.objects.lookup(pk=1)
n.title = "New Title"
n.content = "I sure do love naps!"

# PUT http://127.0.0.1:8000/api/note/1/
n.save()

n = Note.objects.get('note/1/')
# "New Title"
n.title

nap aims to:

  • Support Read (GET) and Write (POST/PUT/PATCH)
  • Required little to no configuration needed for to-spec REST APIs
  • Be easily configurable to fit any REST-like API
  • Be customizable to fit even edgier use cases

Docs

https://nap.readthedocs.org

Installation

% pip install git+https://github.com/jacobb/nap/

nap's People

Contributors

brian-roach-cashstar avatar britonad avatar ccooper123456 avatar ckoch00 avatar dcampbell24 avatar fcurella avatar jacobb avatar jdsmith avatar jkomusin avatar jugallo avatar matteius avatar mcordes avatar mpistrang avatar neruson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nap's Issues

setup.py's use of `open` should explicitly specify encoding

setup.py includes the text of README.rst using open('README.rst').read(). The default behavior for open is to open the file in text mode using the system's preferred encoding to decode the file. Since nap's README.rst contains unicode characters encoded in UTF-8, the default behavior of open can cause installation to break on systems that have a different preferred encoding.

nap's setup.py should explicitly specify UTF-8 as the encoding when reading README.rst. While Python 3's open supports passing an encoding= keyword argument, Python 2.7's open does not. I think codecs.open('README.rst', encoding='utf8') could work across Python 2 & 3.

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.