- 1 year ago
CURL alternative in Python, in Windows 10
Comment
1 / 1
You can use the requests
library in Python as an alternative to CURL. Here's an example:
pythonimport requests
url = 'http://example.com'
response = requests.get(url)
print(response.text)
This will perform a GET request to http://example.com
and print the response body.
If you need to send data as part of your request, you can use the data
parameter:
pythonimport requests
url = 'http://example.com'
data = {'key': 'value'}
response = requests.post(url, data=data)
print(response.text)
This will perform a POST request to http://example.com
with the data specified in the data
dictionary.