Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,45 +42,30 @@ def request_to_v2(message, cookie, user_id, channel_id,context=[]):
|
|
42 |
post_msg_data = json.dumps(post_msg_data)
|
43 |
print(post_msg_data)
|
44 |
|
45 |
-
|
46 |
response = requests.post(post_msg_url, headers=headers, data=post_msg_data, verify=False, stream=False)
|
47 |
print(response)
|
48 |
|
49 |
print(response.status_code)
|
50 |
print(response.request)
|
|
|
51 |
for data in response.iter_lines():
|
52 |
if data:
|
53 |
print(data)
|
|
|
54 |
|
55 |
-
|
56 |
-
# 将事件数据分割为多行
|
57 |
-
# event_data = line.decode('utf-8')
|
58 |
-
# print(event_data)
|
59 |
-
# encoding = chardet.detect(line)['encoding']
|
60 |
-
# print(chardet.detect(line))
|
61 |
-
# decoded_string = line.decode('hex')
|
62 |
-
# print(decoded_string)
|
63 |
-
# event_data = decoded_string.split('\n')
|
64 |
-
# for data in event_data:
|
65 |
-
# if data:
|
66 |
-
# print(data)
|
67 |
-
# response.close()
|
68 |
-
context += [response]
|
69 |
responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
|
70 |
return responses, context
|
71 |
|
72 |
except BaseException as e:
|
73 |
print("查询失败,正在重试")
|
74 |
print(e)
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
except BaseException as e:
|
81 |
-
print("再次查询子域名失败", o)
|
82 |
-
print(e)
|
83 |
-
return False
|
84 |
|
85 |
if __name__ == "__main__":
|
86 |
|
|
|
42 |
post_msg_data = json.dumps(post_msg_data)
|
43 |
print(post_msg_data)
|
44 |
|
45 |
+
try:
|
46 |
response = requests.post(post_msg_url, headers=headers, data=post_msg_data, verify=False, stream=False)
|
47 |
print(response)
|
48 |
|
49 |
print(response.status_code)
|
50 |
print(response.request)
|
51 |
+
bots = ""
|
52 |
for data in response.iter_lines():
|
53 |
if data:
|
54 |
print(data)
|
55 |
+
bots = bots + data
|
56 |
|
57 |
+
context += [bots]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
|
59 |
return responses, context
|
60 |
|
61 |
except BaseException as e:
|
62 |
print("查询失败,正在重试")
|
63 |
print(e)
|
64 |
+
response = e
|
65 |
+
context += [response]
|
66 |
+
responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
|
67 |
+
|
68 |
+
return responses, context
|
|
|
|
|
|
|
|
|
69 |
|
70 |
if __name__ == "__main__":
|
71 |
|