forked from Areyliu/Neo4j-visualization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp.py
More file actions
28 lines (24 loc) · 692 Bytes
/
tmp.py
File metadata and controls
28 lines (24 loc) · 692 Bytes
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
import requests
import json
url = "http://localhost:7474/db/n10s/tx/commit"
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
data = {
"statements": [
{
"statement": "MATCH (n) RETURN n LIMIT 1"
}
]
}
try:
response = requests.post(url, headers=headers, auth=("neo4j", "zxcvbnm106"), json=data)
# 输出原始响应内容
print("Response Status Code:", response.status_code)
print("Response Content:", response.content.decode("utf-8"))
# 尝试将响应内容解析为 JSON
json_data = response.json()
print(json.dumps(json_data, indent=4))
except Exception as e:
print(f"Error: {e}")