To make a HTTP request with a custom header in Python, you can use the requests
library. Here's an example code:
main.py284 chars12 lines
In this code, we define our endpoint URL and the custom header we want to send. We then make the request using requests.get
or requests.post
and pass in the URL and headers as parameters. Finally, we print the response returned by the API.
gistlibby LogSnag