How do I put into my code the REST API requests?

Hi. I’m new to ERPNext and to Rest APIs. I’m just wondering how should I code the REST API requests so that REST would be automated inside a method. I want to run the request whenever I would call upon a method or something like that. Thanks for anyone who could answer.