GithubHelp home page GithubHelp logo

python-api-client's Introduction

python-api-client

Python client to connect to REST based api

This is still in its early stages and needs more tests and functionality for PUT, POST, PATCH and DELETE methods

Install

pip install python-api-client

To run the tests

pip install -r test_requirements.txt

python tests.py

Usage

If you are using Django put the following in to your settings file:

BASE_API_URL = "http://yourdomain.com/api/v2/"

If you are not using Django create a file called settings.py in your project and add the line to that.

Models:

from python_api_client.models import Model


class MyModel(Model):
    """
    This assumes a url of http://yourdomain.com/api/v2/mymodels/...
    if this is not the case you can override

    @classmethod
    def url(cls):
        return 'whatever url you want'

    """
   pass

Views:

from .models import MyModel


my_models = MyModel.objects.all()

some_of_my_models = MyModel.objects.filter(something='s)

my_model = MyModel.objects.get(pk=2)
my_model.field = 'changed'
my_model.save()

python-api-client's People

Contributors

s-block avatar

Watchers

 avatar  avatar

Forkers

aleasam

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.