Skip to content
Advertisement

Python – Converting urllib to requests

I’m writing code to access the MS365 API and the Python code example uses urllib. I want to instead use requests but I’m not sure how urllib translates into requests as my attempts of doing so have failed.

The code example can be found here:

https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/run-advanced-query-sample-python?view=o365-worldwide#get-token

JavaScript

Advertisement

Answer

Modifying @BeRT2me’s answer has made this work.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement