is it anti-pattern to make requests

Hello. I would like to know if a django app, inside a project, make requests to external services is an anti-pattern. In a normal behaviour, the django app only respond to requests made from a client, but is the contrary a safe way?

If it is, what is the correct way?

Thanks in advance.

Welcome @SubaruSama !

No it is not. In fact, it’s quite a common pattern.

However, there’s nothing within Django itself to facilitate doing this. You would write your view to use the Python requests module (or something like it) to issue the requests to the external service. Then it’s up to you do know what to do with the response that you receive before returning a response back out to the browser.

1 Like

Good night Ken, how are you?

Alright, got it. Thanks!