import pycurl
from io import BytesIO
def curl_request():
# Create a buffer to store the response
buffer = BytesIO()
# Create a cURL object
c = pycurl.Curl()
# Set the URL to fetch
c.setopt(c.URL, 'https://httpbin.org/')
# Write the response data to the buffer
c.setopt(c.WRITEDATA, buffer)
# Perform the request
c.perform()
# Close the cURL object
c.close()
# Get the response content
response_body = buffer.getvalue().decode('utf-8')
# Print the response
return response_body
import pycurl
from io import BytesIO
def curl_request():
# Create a buffer to store the response
buffer = BytesIO()
# Create a cURL object
c = pycurl.Curl()
# Set the URL to fetch
c.setopt(c.URL, 'https://httpbin.org/')
# Write the response data to the buffer
c.setopt(c.WRITEDATA, buffer)
# Perform the request
c.perform()
# Close the cURL object
c.close()
# Get the response content
response_body = buffer.getvalue().decode('utf-8')
# Print the response
return response_body