1
+ #import requests
2
+ from dataclasses import dataclass
3
+ import cloudscraper
4
+ from rich .console import Console
5
+
6
+ @dataclass
7
+ class GrokAccount :
8
+ cookies : dict
9
+
10
+ url = "https://grok.com/rest/app-chat/conversations/84d296bb-b410-4e03-9ea4-35f523798dc4/responses"
11
+
12
+ headers = {
13
+ 'accept' : '*/*' ,
14
+ 'accept-language' : 'zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7' ,
15
+ 'baggage' : 'sentry-environment=production,sentry-release=YJ8tdKT6176YR4WZuooH-,sentry-public_key=b311e0f2690c81f25e2c4cf6d4f7ce1c,sentry-trace_id=a5bc59773a46467e9afafa300dea7d1a,sentry-sample_rate=0,sentry-sampled=false' ,
16
+ 'content-type' : 'application/json' ,
17
+ 'dnt' : '1' ,
18
+ 'origin' : 'https://grok.com' ,
19
+ 'priority' : 'u=1, i' ,
20
+ 'referer' : 'https://grok.com/chat/84d296bb-b410-4e03-9ea4-35f523798dc4?referrer=website' ,
21
+ 'sec-ch-ua' : '"Chromium";v="134", "Not:A-Brand";v="24", "Google Chrome";v="134"' ,
22
+ 'sec-ch-ua-mobile' : '?0' ,
23
+ 'sec-ch-ua-platform' : '"Windows"' ,
24
+ 'sec-fetch-dest' : 'empty' ,
25
+ 'sec-fetch-mode' : 'cors' ,
26
+ 'sec-fetch-site' : 'same-origin' ,
27
+ 'sentry-trace' : 'a5bc59773a46467e9afafa300dea7d1a-b51555b3ba4f34de-0' ,
28
+ 'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/134.0.0.0 Safari/537.36'
29
+ }
30
+
31
+ cookies = {
32
+ '_ga' : 'GA1.1.1691019154.1742809195' ,
33
+ 'sso' : 'eyJhbGciOiJIUzI1NiJ9.eyJzZXNzaW9uX2lkIjoiNGNjOTZlOTctYzNlYS00NTUyLTlhYWYtMWI1ZjJiNmY3MDNjIn0.BnY3wcBEA70vch8OHI8a_kBzhKfene7JsEYSvPuHgU0' ,
34
+ 'sso-rw' : 'eyJhbGciOiJIUzI1NiJ9.eyJzZXNzaW9uX2lkIjoiNGNjOTZlOTctYzNlYS00NTUyLTlhYWYtMWI1ZjJiNmY3MDNjIn0.BnY3wcBEA70vch8OHI8a_kBzhKfene7JsEYSvPuHgU0' ,
35
+ 'i18nextLng' : 'zh-TW' ,
36
+ 'cf_clearance' : 'ZpNCBzAzfFEvuvXFd_LwQ55rOEZiZ5nNZCujaRJrOwc-1743233813-1.2.1.1-xrR5zXYyqubufUAaYZLUYc9b25qVg4i1BWsD6oDYHXKc7o2SbapCg7GAETaO1i6YczLcq6yAxaf3qkfKfBstKvPvZp7Faa8IeAUri17n22cPmx_oDN5YAWr58njiTqu8mE3PBYdrmmiWi3leeSVtLPoqwvcDq7eoP3D78KPGTON5KhevogBKvfvf09yu0maUcLbMsqquA0sTKiXh5uXEQpsbmdqUcgMlxaxE5iqPcEhPgaZ8BCX83YK9Tk3S0dXXxASMxK8BUfQ.LDu2AhB6ag1olsCy_nMuVt6W6Tqv3J7GqNj.2gKx0BFt1cBi0kV40TvtFOdCzNBAYKOjFxXsI3tBRT47PNmqtJfuTszH8DI' ,
37
+ '_ga_8FEWB057YH' : 'GS1.1.1743232889.3.1.1743233813.0.0.0'
38
+ }
39
+
40
+ message = """Thank you for your python script"""
41
+
42
+ data = {
43
+ 'message' : message ,
44
+ 'modelName' : 'grok-3' ,
45
+ 'parentResponseId' : '5c84ce2e-bda9-46c1-878d-08e4c3c2f179' ,
46
+ 'disableSearch' : False ,
47
+ 'enableImageGeneration' : True ,
48
+ 'imageAttachments' : [],
49
+ 'returnImageBytes' : False ,
50
+ 'returnRawGrokInXaiRequest' : False ,
51
+ 'fileAttachments' : [],
52
+ 'enableImageStreaming' : True ,
53
+ 'imageGenerationCount' : 2 ,
54
+ 'forceConcise' : False ,
55
+ 'toolOverrides' : {},
56
+ 'enableSideBySide' : True ,
57
+ 'sendFinalMetadata' : True ,
58
+ 'isReasoning' : False ,
59
+ 'webpageUrls' : [],
60
+ 'disableTextFollowUps' : True
61
+ }
62
+
63
+ scraper = cloudscraper .create_scraper ()
64
+ response = scraper .post (url , headers = headers , cookies = cookies , json = data )
65
+ print (response .status_code )
66
+ print (response .text )
0 commit comments