Python aiohttp.__version__() Examples

The following are 10 code examples of aiohttp.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module aiohttp , or try the search function .
Example #1
Source File: test_patches.py    From aiobotocore with Apache License 2.0 6 votes vote down vote up
def test_patches():
    print("Botocore version: {} aiohttp version: {}".format(
        botocore.__version__, aiohttp.__version__))

    success = True
    for obj, digests in chain(_AIOHTTP_DIGESTS.items(), _API_DIGESTS.items()):
        digest = hashlib.sha1(getsource(obj).encode('utf-8')).hexdigest()
        if digest not in digests:
            print("Digest of {}:{} not found in: {}".format(
                obj.__qualname__, digest, digests))
            success = False

    assert success


# NOTE: this doesn't require moto but needs to be marked to run with coverage 
Example #2
Source File: server.py    From gd.py with MIT License 6 votes vote down vote up
def main_page(request: web.Request) -> web.Response:
    """GET /api
    Description:
        Return simple JSON with useful info.
    Example:
        link: /api
    Returns:
        200: JSON with API info.
    Return Type:
        application/json
    """
    payload = {
        "aiohttp": aiohttp.__version__,
        "gd.py": gd.__version__,
        "python": platform.python_version(),
        "routes": list(parse_route_docs()),
    }

    return json_resp(payload) 
Example #3
Source File: __init__.py    From tomodachi with MIT License 5 votes vote down vote up
def version_command(self) -> None:
        print('tomodachi/{}'.format(tomodachi.__version__))
        sys.exit(0) 
Example #4
Source File: http.py    From discord.py with MIT License 5 votes vote down vote up
def __init__(self, connector=None, *, proxy=None, proxy_auth=None, loop=None, unsync_clock=True):
        self.loop = asyncio.get_event_loop() if loop is None else loop
        self.connector = connector
        self.__session = None # filled in static_login
        self._locks = weakref.WeakValueDictionary()
        self._global_over = asyncio.Event()
        self._global_over.set()
        self.token = None
        self.bot_token = False
        self.proxy = proxy
        self.proxy_auth = proxy_auth
        self.use_clock = not unsync_clock

        user_agent = 'DiscordBot (https://github.com/Rapptz/discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}'
        self.user_agent = user_agent.format(__version__, sys.version_info, aiohttp.__version__) 
Example #5
Source File: utils.py    From bandersnatch with Academic Free License v3.0 5 votes vote down vote up
def user_agent() -> str:
    template = "bandersnatch/{version} ({python}, {system})"
    template += f" (aiohttp {aiohttp.__version__})"
    version = __version__
    python = sys.implementation.name
    python += " {}.{}.{}-{}{}".format(*sys.version_info)
    uname = platform.uname()
    system = " ".join([uname.system, uname.machine])
    return template.format(**locals()) 
Example #6
Source File: test_utils.py    From bandersnatch with Academic Free License v3.0 5 votes vote down vote up
def test_user_agent() -> None:
    assert re.match(
        r"bandersnatch/[0-9]\.[0-9]\.[0-9]\.?d?e?v?[0-9]? \(.*\) "
        + fr"\(aiohttp {aiohttp.__version__}\)",
        user_agent(),
    ) 
Example #7
Source File: __main__.py    From gd.py with MIT License 5 votes vote down vote up
def collect_versions() -> Generator[str, None, None]:
    yield f"- python {version_from_info(sys.version_info)}"
    yield f"- gd.py {version_from_info(gd.version_info)}"
    yield f"- aiohttp v{aiohttp.__version__}"
    yield f"- click v{click.__version__}"
    yield "- system {0.system} {0.release} {0.version}".format(platform.uname())


# run main 
Example #8
Source File: http_request.py    From gd.py with MIT License 5 votes vote down vote up
def get_default_agent() -> str:
        string = "gd.py/{} python/{} aiohttp/{}"
        return string.format(gd.__version__, platform.python_version(), aiohttp.__version__) 
Example #9
Source File: __init__.py    From apm-agent-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, app, client=None):
        if not client:
            config = app.get("ELASTIC_APM", {})
            config.setdefault("framework_name", "aiohttp")
            config.setdefault("framework_version", aiohttp.__version__)
            client = Client(config=config)
        app[CLIENT_KEY] = client
        self.app = app
        self.client = client
        self.install_tracing(app, client) 
Example #10
Source File: http.py    From DBL-Python-Library with MIT License 5 votes vote down vote up
def __init__(self, token, **kwargs):
        self.BASE = 'https://top.gg/api'
        self.token = token
        self.loop = asyncio.get_event_loop() if kwargs.get('loop') is None else kwargs.get('loop')
        self.session = kwargs.get('session') or aiohttp.ClientSession(loop=kwargs.get('loop'))
        self._global_over = asyncio.Event(loop=self.loop)
        self._global_over.set()

        user_agent = 'DBL-Python-Library (https://github.com/DiscordBotList/DBL-Python-Library {0}) Python/{1[0]}.{1[1]} aiohttp/{2}'
        self.user_agent = user_agent.format(__version__, sys.version_info, aiohttp.__version__)

    # TODO: better implementation of rate limits
    # NOTE: current implementation doesn't maintain state over restart