what would it be the difference between these two sentences:
res = requests.request('POST', url)
and
res = requests.request.post(url)
They are pretty much the same thing: https://github.com/psf/requests/blob/177dd90f18a8f4dc79a7d2049f0a3f4fcc5932a0/requests/api.py#L103-L115
requests.post(…) is just a wrapper around requests.request('POST', …). As long as you're using standards methods, the former helps readability and reduces the risk of easily avoidable mistakes, while writing the verb.
Edit: updated the source reference, since the domain docs.python-requests.org has expired, and the previous link (http://docs.python-requests.org/en/master/_modules/requests/api/#post) is now invalid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With