benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f1bf2a08-741b-5322-acac-7ac0b3f6ec77

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import socket
import ssl
import http.client

def task_func(SERVER_NAME, SERVER_PORT, path):
    """
    Makes an HTTPS GET request to a specified server and path, and retrieves the response.

    Parameters:
        SERVER_NAME (str): The name of the server to which the request is made.
        SERVER_PORT (int): The port number of the server to which the request is made.
        path (str): The path for the HTTP request.

    Returns:
        str: The response body from the server as a string.

    Raises:
        ssl.SSLError: If there is an SSL handshake error.

    Requirements:
    - socket
    - ssl
    - http.client

    Examples:
    >>> response = task_func('www.example.com', 443, '/path/to/request')
    >>> isinstance(response, str)
    True
    """

instruct prompt

Makes an HTTPS GET request to a specified server and path, and retrieves the response.
The function should raise the exception for: ssl.SSLError: If there is an SSL handshake error.
The function should output with:
    str: The response body from the server as a string.
You should write self-contained code starting with:

Code

import socket
import ssl
import http.client
def task_func(SERVER_NAME, SERVER_PORT, path):

code prompt

Code

import socket
import ssl
import http.client
def task_func(SERVER_NAME, SERVER_PORT, path):

entry point

task_func

libs

  • http
  • socket
  • ssl

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import