GithubHelp home page GithubHelp logo

aspenmayer / acf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inspectorioinc/acf

0.0 1.0 0.0 77 KB

API Client Framework. The framework for building well structured API client libraries in Python.

License: MIT License

Python 100.00%

acf's Introduction

API Client Framework

The framework for building well structured API client libraries in Python.

Minimal API client implementation

The simplest implementation of the API client based on ACF could look like this:

from acf.actions.http import HttpAction
from acf.clients.base import BaseClient
from acf.resources.base import BaseResource


class SendAnythingAction(HttpAction):

    METHOD = 'POST'
    URL_PATH_TEMPLATE = 'https://httpbin.org/anything'
    RESULT_KEY = 'json'


class AnythingResource(BaseResource):

    ACTIONS = {
        'send': SendAnythingAction
    }


class HttpbinClient(BaseClient):

    RESOURCES = {
        'anything': AnythingResource
    }

Example of the minimal API client usage

You can evaluate the code above or just execute the following line for importing the Httpbin client.

from acf_example.httpbin_client import HttpbinClient

After that you'll be able to send any test data!

>>> client = HttpbinClient()
>>> api_result = client.anything.send(foo='bar')
>>> api_result.is_successful
True

>>> api_result.response
<Response [200]>

>>> api_result.result
{'foo': 'bar'}

acf's People

Contributors

jamim avatar nikolay-saskovets avatar spacesphere 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.