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

[BUG] GroupingError #188

Open
xiaoyao1949 opened this issue Sep 10, 2019 · 3 comments
Open

[BUG] GroupingError #188

xiaoyao1949 opened this issue Sep 10, 2019 · 3 comments

Comments

@xiaoyao1949
Copy link

xiaoyao1949 commented Sep 10, 2019

error
here is my code:

async def request(
        self,
        method: Text = "post",
        subpath: Optional[Text] = None,
        content_type: Optional[Text] = "application/json",
        return_method: Text = "json",
        **kwargs: Any
    ):
        """Send a HTTP request to the endpoint.

        All additional arguments will get passed through
        to aiohttp's `session.request`."""

        # create the appropriate headers
        headers = {}
        if content_type:
            headers["Content-Type"] = content_type

        if "headers" in kwargs:
            headers.update(kwargs["headers"])
            del kwargs["headers"]

        url = concat_url(self.url, subpath)
        async with self.session() as session:
            async with session.request(
                method,
                url,
                headers=headers,
                params=self.combine_parameters(kwargs),
                **kwargs
            ) as resp:
                if resp.status >= 400:
                    raise ClientResponseError(
                        resp.status, resp.reason, await resp.content.read()
                    )
                return await getattr(resp, return_method)()
@Jackenmen
Copy link

I have the same problem with all objects that I await and pass to a function in same expression, e.g.

max(await x())

or

l = []
l.append(await y())

If I put parentheses around awaited object, it will work, so:

max(await (x()))

or

l = []
l.append(await (y()))

doesn't raise this error.

@webknjaz
Copy link
Contributor

webknjaz commented Jan 7, 2020

Looks like the grammar in baron is ready but a redbaron wrapper is missing: https://baron.readthedocs.io/en/latest/grammar.html#async-with

@MoBoo
Copy link

MoBoo commented Oct 12, 2023

Problem still exists to this date.
Is there any update on this?

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

4 participants