Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for async clients #17

Open
d1618033 opened this issue Mar 11, 2020 · 1 comment
Open

Support for async clients #17

d1618033 opened this issue Mar 11, 2020 · 1 comment

Comments

@d1618033
Copy link
Contributor

Is there support for async clients (like aiohttp)?

I'm running the following code, and the sync version is working fine, but the async version is timing out.

import asyncio

import aiohttp
import flask
import requests
from flask_loopback import FlaskLoopback

app = flask.Flask(__name__)
@app.route("/")
def index():
    return "index"


async def async_client():
    async with aiohttp.ClientSession() as client:
        async with client.get("http://mock/") as response:
            print("async_client", await response.text())


def sync_client():
    print("sync_client", requests.get("http://mock/").text)


with FlaskLoopback(app).on(("mock", 80)):
    sync_client()
    asyncio.run(async_client())
@vmalloc
Copy link
Owner

vmalloc commented Mar 11, 2020

Nope, this isn't implemented at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants