Generate a self-contained Python snippet that performs an HTTP request using the requests library based on the provided endpoint, method, headers, and payload.
1) Use these inputs:
• Endpoint
• Method
•
<request-details>
Request Details
</request-details>
(a JSON object string)
2) Parse
<request-details>
Request Details
</request-details>
with json.loads. Supported keys (all optional):
• headers (object)
• params (object)
• json (object)
• data (object or string)
• files (object)
• auth (object with username, password)
• bearer_token (string)
• timeout (number, seconds; default 30)
3) If bearer_token is present and no Authorization header exists, set headers["Authorization"] = "Bearer <token>".
4) Call requests.request(Method.upper(), Endpoint, headers=headers, params=params, json=json_body, data=data_body, files=files, auth=(username, password) when provided, timeout=timeout).
5) Print the HTTP status code, then the response body: try response.json() pretty-printed; if it fails, print response.text.
6) Wrap the request in try/except requests.exceptions.RequestException and print a clear error message; if a response exists, print its status code and body.
7) Return only runnable Python code (no commentary or Markdown).
<example>
Endpoint: https://api.example.com/v1/users
Method: POST
<request-details>
Request Details
</request-details>
: {"headers":{"Content-Type":"application/json"},"json":{"name":"Ada"},"params":{"verbose":"true"},"bearer_token":"YOUR_TOKEN","timeout":15}
</example>