Skip to content

Instantly share code, notes, and snippets.

View BeautyyuYanli's full-sized avatar
🐈
meow~

盐粒 Yanli BeautyyuYanli

🐈
meow~
View GitHub Profile
# This is the workround before https://github.com/pydantic/pydantic-ai/issues/224 is fixed
from pydantic_ai.models.openai import (
OpenAIModel,
OpenAIModelSettings,
ModelRequestParameters,
)
from itertools import chain
from openai import NOT_GIVEN, AsyncOpenAI, AsyncStream
from openai.types import ChatModel, chat
import asyncio
from typing import (
Any,
Awaitable,
Generator,
Generic,
Tuple,
TypeVar,
Union,
)
@BeautyyuYanli
BeautyyuYanli / http_once.py
Created December 1, 2023 16:38
Listen for http request only once, to complete OAuth2.0 locally.
import socket
from typing import Optional
def http_once(
host: str,
port: int,
buffer_size: int = 4096,
timeout: Optional[float] = None,
response: str = "OK",
include tencent-qq.local
# Persistent global definitions
include globals.local
noblacklist ${HOME}/.config/QQ
# Allow opening hyperlinks
include allow-bin-sh.inc
include disable-common.inc