Update api/config.py
Browse files- api/config.py +24 -0
api/config.py
CHANGED
|
@@ -3,6 +3,7 @@ from dotenv import load_dotenv
|
|
| 3 |
|
| 4 |
load_dotenv()
|
| 5 |
|
|
|
|
| 6 |
BASE_URL = "https://www.blackbox.ai"
|
| 7 |
common_headers = {
|
| 8 |
'accept': '*/*',
|
|
@@ -10,9 +11,32 @@ common_headers = {
|
|
| 10 |
'cache-control': 'no-cache',
|
| 11 |
'origin': BASE_URL,
|
| 12 |
'pragma': 'no-cache',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
|
| 14 |
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
| 15 |
'Chrome/130.0.0.0 Safari/537.36',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
APP_SECRET = os.getenv("APP_SECRET")
|
| 18 |
|
|
|
|
| 3 |
|
| 4 |
load_dotenv()
|
| 5 |
|
| 6 |
+
# Base URL and Common Headers
|
| 7 |
BASE_URL = "https://www.blackbox.ai"
|
| 8 |
common_headers = {
|
| 9 |
'accept': '*/*',
|
|
|
|
| 11 |
'cache-control': 'no-cache',
|
| 12 |
'origin': BASE_URL,
|
| 13 |
'pragma': 'no-cache',
|
| 14 |
+
'priority': 'u=1, i',
|
| 15 |
+
'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
| 16 |
+
'sec-ch-ua-mobile': '?0',
|
| 17 |
+
'sec-ch-ua-platform': '"Windows"',
|
| 18 |
+
'sec-fetch-dest': 'empty',
|
| 19 |
+
'sec-fetch-mode': 'cors',
|
| 20 |
+
'sec-fetch-site': 'same-origin',
|
| 21 |
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
|
| 22 |
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
| 23 |
'Chrome/130.0.0.0 Safari/537.36',
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
# Header Configurations for Specific API Calls
|
| 27 |
+
def get_headers_api_chat(referer_url):
|
| 28 |
+
return {**common_headers, 'Content-Type': 'application/json', 'Referer': referer_url}
|
| 29 |
+
|
| 30 |
+
def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
| 31 |
+
return {
|
| 32 |
+
**common_headers,
|
| 33 |
+
'Accept': 'text/x-component',
|
| 34 |
+
'Content-Type': 'text/plain;charset=UTF-8',
|
| 35 |
+
'Referer': chat_url,
|
| 36 |
+
'next-action': next_action,
|
| 37 |
+
'next-router-state-tree': next_router_state_tree,
|
| 38 |
+
'next-url': '/',
|
| 39 |
+
}
|
| 40 |
|
| 41 |
APP_SECRET = os.getenv("APP_SECRET")
|
| 42 |
|