Code refactoring, added method to create requests.

A new method `_request` was created to handle GET and POST requests.
This allows us to remove repeated code and improve readability.