INNER CODE UNIT · Python
_escape_graphql_string
shuvonsec/claude-bug-bounty · mcp/hackerone-mcp/server.py:49
def _escape_graphql_string(s: str) -> str:
"""Escape a value for safe interpolation inside a GraphQL double-quoted string."""
return (s
.replace("\\", "\\\\")
.replace('"', '\\"')
.replace("\n", "\\n")
.replace("\r", "\\r")
.replace("\t", "\\t"))
class HackerOneAPIError(Exception):
"""Raised on API failures (rate limit, timeout, bad response)."""
def __init__(self, message, status_code=None):
super().__init__(message)
self.status_code = status_code
def _graphql_request(query: str, timeout: int = DEFAULT_TIMEOUT) -> dict: