Last active
June 9, 2025 06:32
-
-
Save aiyogg/a8241b5bfc9904397aaa55191d9d74dd to your computer and use it in GitHub Desktop.
mitmproxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mitmproxy import http | |
def request(flow: http.HTTPFlow) -> None: | |
# Check if the request is to api.openai.com and has the specific referer | |
if "api.openai.com" in flow.request.host and flow.request.headers.get("http-referer") == "https://cherry-ai.com": | |
# Headers to remove | |
headers_to_remove = ["x-stainless-timeout", "x-stainless-retry-count"] | |
# Remove specified headers if they exist | |
for header in headers_to_remove: | |
if header in flow.request.headers: | |
del flow.request.headers[header] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment