-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch_data.py
More file actions
51 lines (37 loc) · 1.18 KB
/
search_data.py
File metadata and controls
51 lines (37 loc) · 1.18 KB
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
import requests
import json
# Define the URL of the Flask API endpoint
url = "http://127.0.0.1:5000/execute"
data = {
"command": "input_id",
"params": {
"text":"Πειραιάς, Ελλάδα",
"method":"css_selector",
"selector": 'input[placeholder="Περιοχή"]'
}
}
# Define the headers for the request (Content-Type set to JSON)
headers = {
"Content-Type": "application/json"
}
# Send the POST request to the Flask API
response = requests.post(url, headers=headers, data=json.dumps(data))
# Print the response from the server
print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")
data = {
"command": "click",
"params": {
"method":"xpath",
"selector": '//*[@id="g-search-bar"]/button'
}
}
# Define the headers for the request (Content-Type set to JSON)
headers = {
"Content-Type": "application/json"
}
# Send the POST request to the Flask API
response = requests.post(url, headers=headers, data=json.dumps(data))
# Print the response from the server
print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")