File size: 2,551 Bytes
c03acd5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
import requests
import json
def send_chat_request():
# Define the URL of the API endpoint
url = 'https://www.blackbox.ai/api/chat'
# Headers
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
'Content-Type': 'application/json' # Assuming the API expects JSON format
}
# Payload
payload = {
"agentMode": {},
"clickedAnswer2": False,
"clickedAnswer3": False,
"clickedForceWebSearch": False,
"codeModelMode": True,
"githubToken": None,
"id": "hFnU6fo",
"isChromeExt": False,
"isMicMode": False,
"maxTokens": 1024,
"messages": [
{
"id": "hFnU6fo",
"content": "GIve me FULL NEWS ABOUT BTC YOU CAN GET IT FROM WEB",
"role": "user"
}
],
"mobileClient": False,
"previewToken": None,
"trendingAgentMode": {},
"userId": None,
"userSelectedModel": None,
"visitFromDelta": False
}
# Send the POST request
response = requests.post(url, headers=headers, data=json.dumps(payload))
first = response.text# Print the response text
return first
def send_chat_request_v2(first):
# Define the URL of the API endpoint
url = 'https://www.blackbox.ai/api/chat'
# Headers
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
'Content-Type': 'application/json' # Assuming the API expects JSON format
}
# Payload
payload = {
"agentMode": {},
"id": "hFnU6fo",
"messages": [
{
"id": "hFnU6fo",
"content": "GIve me FULL NEWS ABOUT BTC YOU CAN GET IT FROM WEB",
"role": "user"
},
{
"id": "9RsMsaM",
"createdAt": "2024-09-21T08:11:09.953Z",
"content": first
,
"role": "assistant"
}
],
"mobileClient": False,
"mode": "continue",
"trendingAgentMode": {},
"userId": None
}
# Send the POST request
response = requests.post(url, headers=headers, data=json.dumps(payload))
second = response.text# Print the response text
return second
first = send_chat_request()
second = send_chat_request_v2(first)
print (f"{first}{second}")
|