Skip to content

Document how to skip SSL checks #45

@Gallaecio

Description

@Gallaecio

While I don’t think #5 is the way to go, documenting how to skip SSL checks may be useful for people for whom getting things working is, at a given time, more important that any security concerns related to SSL.

Something like this should work with the current API, and we could simplify it and cover it in the docs:

import asyncio
import json
from base64 import b64decode

from aiohttp import TCPConnector
from zyte_api.aio.client import AsyncClient, create_session


async def main():
    client = AsyncClient()
    async with create_session(connector=TCPConnector(ssl=False)) as session:
        api_response = await client.request_raw(
            {
                "url": "https://toscrape.com",
                "httpResponseBody": True,
                "httpRequestMethod": "POST",
                "httpRequestBody": "Zm9v",
            },
            session=session,
        )
    http_response_body: bytes = b64decode(api_response["httpResponseBody"])
    body_text: str = http_response_body.decode()
    print(body_text)


asyncio.run(main())

Alternatively, we could consider making it easy to disable SSL checking with a boolean API parameter. No strong opinion either way from me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions