import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url = "https://api.scale.com/v1/batches"
# Define the payload for creating a new batch
payload = {
"project": "kitten_labeling", # The project associated with the batch
"name": "kitten_labeling_2020-07", # The name of the batch
"calibration_batch": False, # Indicates if the batch is a calibration batch
"self_label_batch": False # Indicates if the batch is a self-label batch
}
# Set up the headers for the request
headers = {
"accept": "application/json", # Specify that we want the response in JSON format
"content-type": "application/json" # Specify the content type of the request
}
# Adding authentication to the POST request
# The auth parameter requires a tuple with the API key and an empty string
response = requests.post(url, json=payload, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)