GithubHelp home page GithubHelp logo

Comments (10)

neumond avatar neumond commented on July 29, 2024

Monkeypatch workaround

    import yarl
    original_with_query = yarl.URL.with_query

    def new_with_query(self, *args, **kwargs):
        if kwargs:
            query = kwargs
        elif len(args) == 1:
            query = args[0]
        if isinstance(query, Mapping) and 'refresh' in query and isinstance(query['refresh'], bool):
            query['refresh'] = '1' if query['refresh'] else '0'
        return original_with_query(self, *args, **kwargs)

    yarl.URL.with_query = new_with_query

from aioes.

asvetlov avatar asvetlov commented on July 29, 2024

Would you provide a patch which fixes aioes, without yarl monkeypatching?

from aioes.

neumond avatar neumond commented on July 29, 2024

There're two ways of solving this problem: modifying yarl for bool support and replacing bool parameters everywhere is aioes. What can you consider correct?

from aioes.

asvetlov avatar asvetlov commented on July 29, 2024

The second one

from aioes.

wintamute avatar wintamute commented on July 29, 2024

Any plans on merging this and doing a new release soon?

from aioes.

neumond avatar neumond commented on July 29, 2024

@wintamute I would prefer to be able to convert from bool instead passing as is. refresh=True looks more reasonable than refresh=1.

from aioes.

wintamute avatar wintamute commented on July 29, 2024

@neumond I agree, I was referring to the commit above (DLizogub@77c4d56)
Edit: I just checked that commit again, my bad, the fix should be to convert here to str instead of passing as is so that yarl doesn't complain later on. I didn't try it I admit.
Using a local modified version doesn't really help me since I need a version the build system can just download.

from aioes.

kr41 avatar kr41 commented on July 29, 2024

A less hackish monkey-patch to workaround this issue as well as #112

from aioes.connection import Connection

__original_perform_request = Connection.perform_request

def perform_request(self, method, url, params, body):
    url = url.lstrip('/')  # Fixes issue #112
    if params:
        for key, value in params.items():
            if isinstance(value, bool):
                params[key] = str(value).lower()
    return __original_perform_request(self, method, url, params, body)

Connection.perform_request = perform_request

from aioes.

popravich avatar popravich commented on July 29, 2024

Hey, guys! Please check this out with latest master!

from aioes.

haizaar avatar haizaar commented on July 29, 2024

Looks very much so. Many thanks for giving some love to ES5 support.

from aioes.

Related Issues (20)

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.