用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/majiayu000/claude-skill-registry --skill requests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
LLM token logprobs and calibration. Per-decision confidence, ECE, Brier, reliability diagrams, low-confidence triage.
Analyze LLM token logprobs and calibration. Use for per-decision confidence, ECE, Brier scores, reliability diagrams, and low-confidence triage.
回顾最近 N 天的 Claude Code 使用记录——扫描原始会话数据,按主题分组汇总"我都做了什么",并从个人操作系统视角输出模式、风险与增删建议。当用户说 /recap、"看看我这几天做了什么"、"回顾一下我最近的会话"、"这两天我用 claude 干了啥"、"活动回顾" 时使用。
基于 SOC 职业分类
正在显示 SKILL.md
| name | requests |
| description | Synchronous HTTP client for sending HTTP requests and handling responses. |
| version | 2.32.5 |
| ecosystem | python |
| license | MIT |
| generated_with | gpt-5.2 |
import requests
from requests import Session
from requests.auth import HTTPBasicAuth, HTTPDigestAuth, AuthBase
from requests.exceptions import (
RequestException,
Timeout,
ConnectTimeout,
ReadTimeout,
ConnectionError,
HTTPError,
TooManyRedirects,
JSONDecodeError,
)
from __future__ import annotations
import requests
def fetch_repo(owner: str, repo: str) -> dict:
url = "https://api.github.com/repos/{owner}/{repo}".format(owner=owner, repo=repo)
r = requests.get(url, params={"per_page": 1}, timeout=10)
r.raise_for_status()
return r.json()
if __name__ == "__main__":
data = fetch_repo("psf", "requests")
print(data["full_name"])
params= for query strings; call Response.raise_for_status() before trusting the body.from __future__ import annotations
import requests
def create_widget(api_base: str, token: str, name: str) -> dict:
url = f"{api_base}/post"
headers = {"Authorization": f"Bearer {token}"}
r = requests.post(
url,
json={"name": name},
headers=headers,
timeout=10,
)
r.raise_for_status()
return r.json()
if __name__ == "__main__":
# Example: using httpbin.org/post to echo back JSON
api_base = "https://httpbin.org"
token = "testtoken123"
name = "mywidget"
result = create_widget(api_base, token, name)
# httpbin.org returns JSON with keys: json, headers, url, etc.
assert isinstance(result, dict)
# The JSON body should be echoed back under "json"
assert result.get("json") == {"name": name}
# The Authorization header should be present (case-insensitive)
headers = result.get("headers", {})
authval = headers.get("Authorization") or headers.get("authorization")
assert authval and token in authval
# The URL should end with /post
assert result.get("url", "").endswith()
()
json= for JSON request bodies (sets JSON encoding; also sets an appropriate Content-Type).from __future__ import annotations
import requests
def fetch_many(urls: list[str]) -> list[tuple[str, int]]:
results: list[tuple[str, int]] = []
with requests.Session() as s:
s.headers.update({"User-Agent": "example-client/1.0"})
for url in urls:
r = s.get(url, timeout=10)
results.append((r.url, r.status_code))
return results
if __name__ == "__main__":
out = fetch_many(["https://httpbin.org/get", "https://example.com/"])
print(out)
requests.Session() (or requests.session()) for connection pooling and shared headers/cookies.from __future__ import annotations
import requests
def download_file(url: str, path: str) -> None:
with requests.get(url, stream=True, timeout=30) as r:
r.raise_for_status()
with open(path, "wb") as f:
for chunk in r.iter_content(chunk_size=1024 * 128):
if chunk: # filter out keep-alive chunks
f.write(chunk)
if __name__ == "__main__":
download_file("https://httpbin.org/bytes/1024", "out.bin")
print("Wrote out.bin")
stream=True and Response.iter_content(); write to a binary file.from __future__ import annotations
import requests
from requests.auth import AuthBase, HTTPBasicAuth, HTTPDigestAuth
class BearerAuth(AuthBase):
def __init__(self, token: str) -> None:
self._token = token
def __call__(self, r: requests.PreparedRequest) -> requests.PreparedRequest:
r.headers["Authorization"] = f"Bearer {self._token}"
return r
def demo_auth() -> None:
# Basic auth (tuple shorthand also works: auth=("user", "pass"))
r1 = requests.get("https://httpbin.org/basic-auth/user/pass", auth=HTTPBasicAuth("user", "pass"), timeout=10)
print(r1.status_code)
# Digest auth
r2 = requests.get("https://httpbin.org/digest-auth/auth/user/pass", auth=HTTPDigestAuth("user", "pass"), timeout=10)
print(r2.status_code)
# Custom auth
r3 = requests.get("https://httpbin.org/bearer", auth=BearerAuth("secret-token"), timeout=10)
print(r3.status_code)
if __name__ == "__main__":
demo_auth()
auth=("user","pass") or HTTPBasicAuth for Basic; HTTPDigestAuth for Digest; subclass AuthBase for custom schemes.timeout= (float seconds or (connect, read) tuple) to avoid hanging indefinitely.allow_redirects= (e.g., requests.get(..., allow_redirects=False)).verify=True). Override per request with verify=False (discouraged) or verify="/path/to/ca-bundle.pem".proxies= dict or environment variables (e.g., HTTPS_PROXY, HTTP_PROXY, NO_PROXY) when Session.trust_env is True..netrc for credentials when auth= is not provided. Disable by setting Session.trust_env = False.Response.encoding manually only when you know the correct encoding before accessing Response.text.from __future__ import annotations
import requests
r = requests.get("https://httpbin.org/status/500", timeout=10)
data = r.json() # may succeed/fail independently of HTTP status
print(data)
from __future__ import annotations
import requests
r = requests.get("https://httpbin.org/status/500", timeout=10)
r.raise_for_status()
print(r.json())
from __future__ import annotations
import requests
r = requests.get("https://httpbin.org/status/204", timeout=10)
print(r.json()) # raises requests.exceptions.JSONDecodeError
from __future__ import annotations
import requests
from requests.exceptions import JSONDecodeError
r = requests.get("https://httpbin.org/status/204", timeout=10)
if r.status_code == 204:
print(None)
else:
try:
print(r.json())
except JSONDecodeError:
print(None)
from __future__ import annotations
import requests
r = requests.get("https://httpbin.org/bytes/10", timeout=10)
raw_bytes = r.raw.read() # not the intended pattern without stream=True
print(raw_bytes)
from __future__ import annotations
import requests
with requests.get("https://httpbin.org/bytes/10", stream=True, timeout=10) as r:
r.raise_for_status()
data = b"".join(r.iter_content(chunk_size=4))
print(data)
from __future__ import annotations
import requests
s = requests.Session()
# May consult environment (.netrc, proxy env vars, etc.) by default:
r = s.get("https://example.com/private", timeout=10)
print(r.status_code)
from __future__ import annotations
import requests
s = requests.Session()
s.trust_env = False
r = s.get("https://example.com/private", timeout=10)
print(r.status_code)
<2.32.5 temporarily and upgrade Python.HTTPAdapter, Requests introduced a new public method for connection acquisition with TLS context (get_connection_with_tls_context) and considers get_connection deprecated in Requests >=2.32.0. Update adapter overrides accordingly.>=2.31.0 to avoid potential Proxy-Authorization leakage on HTTPS redirects; rotate proxy credentials after upgrading.headers, timeout, auth, cookies, allow_redirects, proxies, verify, cert, stream.json= for JSON bodies.allow_redirects=)..get()/.post() etc.; configure headers, cookies, proxies, verify, trust_env.requests.Session..status_code, .headers, .url, .text, .content, .encoding, .json(), .raise_for_status(), .iter_content(), .raw (with stream=True).timeout= to control.Response.raise_for_status() on 4xx/5xx.{
"library_category": "http_client",
"apis": [
{
"name": "requests.get",
"type": "function",
"signature": "get(url, params=None, **kwargs)",
"signature_truncated": false,
"return_type": "Response",
"module": "requests.api",
"publicity_score": "high",
"module_type": "public",
"decorators": [],
"deprecation": {
"is_deprecated": false
},
"type_hints"
Notes:
requests/__init__.py and __all__ patterns).requests.utils), let me know.Response or Session, specify, and a more granular breakdown can be provided.http_client as the category.<2.32.5 temporarily and upgrade Python as soon as possible.HTTPAdapter, use the new get_connection_with_tls_context method instead of the now-deprecated get_connection. See the Requests changelog and PR #6710 for migration examples.>=2.31.0 to avoid possible Proxy-Authorization header leakage on HTTPS redirects. Rotate proxy credentials after upgrading.No core HTTP API endpoints were removed or had their signatures changed in 2.32.x.
Response.json() on invalid/empty JSON.requests.codes.ok).