Sends a POST request to the GitHub API with automatic retries. Args: url (str): The URL endpoint. payload (Any): The JSON payload. Returns: Any: The JSON response.
(url: str, payload: Any)
| 121 | |
| 122 | |
| 123 | def post_request(url: str, payload: Any) -> Any: |
| 124 | """ |
| 125 | Sends a POST request to the GitHub API with automatic retries. |
| 126 | |
| 127 | Args: |
| 128 | url (str): The URL endpoint. |
| 129 | payload (Any): The JSON payload. |
| 130 | |
| 131 | Returns: |
| 132 | Any: The JSON response. |
| 133 | """ |
| 134 | _increment_api_call_count() |
| 135 | try: |
| 136 | response = _session.post(url, json=payload, timeout=60) |
| 137 | response.raise_for_status() |
| 138 | return response.json() |
| 139 | except requests.exceptions.RequestException as e: |
| 140 | logger.error(f"POST request failed for {url}: {e}") |
| 141 | raise |
| 142 | |
| 143 | |
| 144 | def patch_request(url: str, payload: Any) -> Any: |
no test coverage detected