> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Best practice

<AccordionGroup>
  <Accordion title="use-timeout">
    Detected a 'requests' call without a timeout set. By default, 'requests' calls wait until the connection is closed. This means a 'requests' call without a timeout will hang the program if a response is never received. Consider setting a timeout for all 'requests'.
  </Accordion>

  <Accordion title="use-raise-for-status">
    There's an HTTP request made with requests, but the raise\_for\_status() utility method isn't used. This can result in request errors going unnoticed and your code behaving in unexpected ways, such as if your authorization API returns a 500 error while you're only checking for a 401.
  </Accordion>

  <Accordion title="python.requests.best-practice.use-request-json-shortcut">
    The requests library has a convenient shortcut for sending JSON requests, which lets you stop worrying about serializing the body yourself. To use it, replace `body=json.dumps(...)` with `json=...`.
  </Accordion>

  <Accordion title="python.requests.best-practice.use-response-json-shortcut">
    The requests library has a convenient shortcut for reading JSON responses, which lets you stop worrying about deserializing the response yourself.
  </Accordion>
</AccordionGroup>
