Giter Site home page Giter Site logo

cloudblue / connect-python-openapi-client Goto Github PK

View Code? Open in Web Editor NEW
16.0 6.0 5.0 750 KB

Connect API Client based on the OpenAPI specification for Python 3.7+

Home Page: https://connect.cloudblue.com

License: Apache License 2.0

Python 100.00%

connect-python-openapi-client's Introduction

Connect Python OpenAPI Client

pyversions PyPi Status Build Status codecov Quality Gate Status

Introduction

Connect Python OpenAPI Client is the simple, concise, powerful and REPL-friendly CloudBlue Connect API client.

It has been designed following the fluent interface design pattern.

Due to its REPL-friendly nature, using the CloudBlue Connect OpenAPI specifications it allows developers to learn and play with the CloudBlue Connect API using a python REPL like jupyter or ipython.

Install

Connect Python OpenAPI Client requires python 3.8 or later.

Connect Python OpenAPI Client can be installed from pypi.org using pip:

$ pip install connect-openapi-client

Development

We use isort library to order and format our imports, and black - to format the code. We check it using flake8-isort and flake8-black libraries (automatically on flake8 run).
For convenience you may run isort . && black . to format the code.

Documentation

Connect Python OpenAPI Client documentation is hosted on the Read the Docs service.

License

Connect Python OpenAPI Client is released under the Apache License Version 2.0.

connect-python-openapi-client's People

Contributors

bdjilka avatar d3rky avatar ffaraone avatar gab832 avatar gustavorioita avatar hairash avatar marcserrat avatar qarlosh avatar vgrebenschikov avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

connect-python-openapi-client's Issues

Should different filter approach be used for AsyncConnectClient?

Context: I am implementing demo extension that will automatically approve all incoming requests. The approve action requires template_id to be provided, so if there is one template - I do not want to hardcode the template id.

Using the async libraries, looks like the filters do not work on templates.

Consider the following code:

# export API_KEY="ApiKey ..."
# python test_filter.py
[{'id': 'TL-843-435-779'}]
[{'id': 'TL-843-435-779'}, {'id': 'TL-125-264-717'}, {'id': 'TL-790-939-369'}, {'id': 'TL-498-000-563'}]

test_filter.py runs the same query on sync and async clients. The query retrieves templates by type "fulfillment":

from os import environ

import asyncio

from connect.client import ConnectClient, AsyncConnectClient

product_id = "PRD-620-226-877"
api_key = environ.get("API_KEY")


def run_sync():
    c = ConnectClient(api_key)
    return list(c.products[product_id].templates.filter(type="fulfillment").values_list("id"))


def run_async():
    c = AsyncConnectClient(api_key)

    async def get_templates():
        return list([_ async for _ in c.products[product_id].templates.filter(type="fulfillment").values_list("id")])

    return asyncio.run(get_templates())


if __name__ == "__main__":
    print(run_sync())
    print(run_async())

Am I using the filters incorrectly in asynchronous approach?

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.