benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 45ddf65f-528f-51ea-8b53-6325144c38e8

Problem

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

complete prompt

import re
import json
import requests

def task_func(myString, token):
    """
    Extracts a URL from a string and sends it to a REST API via a POST request. The URL is included in the JSON payload,
    and an authorization token is used in the headers for API access. If multiple URL is in myString, then use the first one

    Parameters:
    myString (str): The string from which to extract the URL.
    token (str): The authorization token required for API access.

    Returns:
    dict: The response from the API, which varies based on the API's implementation.

    Requirements:
    - re
    - json
    - requests

    Example:
    >>> task_func('Please check: https://www.google.com', 'your_token_here')
    {'message': 'URL received'}
    """

instruct prompt

Extracts a URL from a string and sends it to a REST API via a POST request. The URL is included in the JSON payload, and an authorization token is used in the headers for API access. If multiple URL is in myString, then use the first one
The function should output with:
    dict: The response from the API, which varies based on the API's implementation.
You should write self-contained code starting with:

Code

import re
import json
import requests
def task_func(myString, token):

code prompt

Code

import re
import json
import requests
def task_func(myString, token):

entry point

task_func

libs

  • requests
  • re
  • json

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