'init'
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import requests
|
||||
|
||||
profileId = 'XX'
|
||||
url = "http://localhost:50325/api/v1/browser/active?user_id=" + profileId
|
||||
|
||||
response = requests.request("GET", url, headers={}, data={})
|
||||
|
||||
print(response.text)
|
||||
15
localAPI-main/py-examples/example-create-group.py
Normal file
15
localAPI-main/py-examples/example-create-group.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import json
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/group/create"
|
||||
|
||||
payload = {
|
||||
"group_name": "your_group_name"
|
||||
}
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
41
localAPI-main/py-examples/example-create-profile.py
Normal file
41
localAPI-main/py-examples/example-create-profile.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/user/create"
|
||||
|
||||
payload = {
|
||||
"name": "test",
|
||||
"group_id": "0",
|
||||
"domain_name": "facebook.com",
|
||||
"repeat_config": [
|
||||
"0"
|
||||
],
|
||||
"country": "us",
|
||||
"fingerprint_config": {
|
||||
"language": [
|
||||
"en-US"
|
||||
],
|
||||
"ua": "Mozilla/5.0 (Linux; Android 8.0.0; BND-AL10 Build/HONORBND-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/63.0.3239.83 Mobile Safari/537.36 T7/11.5 baiduboxapp/11.5.0.10 (Baidu; P1 8.0.0)",
|
||||
"flash": "block",
|
||||
"scan_port_type": "1",
|
||||
"screen_resolution": "1024_600",
|
||||
"fonts": [
|
||||
"all"
|
||||
],
|
||||
"longitude": "180",
|
||||
"latitude": "90",
|
||||
"webrtc": "proxy",
|
||||
"do_not_track": "true",
|
||||
"hardware_concurrency": "default",
|
||||
"device_memory": "default"
|
||||
},
|
||||
"user_proxy_config": {
|
||||
"proxy_soft": "no_proxy"
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
10
localAPI-main/py-examples/example-delete-profile-cache.py
Normal file
10
localAPI-main/py-examples/example-delete-profile-cache.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import requests
|
||||
|
||||
url = "http://localhost:50325/api/v1/user/delete-cache"
|
||||
|
||||
payload={}
|
||||
headers = {}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
16
localAPI-main/py-examples/example-delete-profile.py
Normal file
16
localAPI-main/py-examples/example-delete-profile.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import requests
|
||||
|
||||
url = "http://localhost:50325/api/v1/user/delete"
|
||||
|
||||
payload = {
|
||||
"user_ids": [
|
||||
"XX"
|
||||
]
|
||||
}
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
10
localAPI-main/py-examples/example-query-group.py
Normal file
10
localAPI-main/py-examples/example-query-group.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/group/list?page=1&page_size=15"
|
||||
|
||||
payload={}
|
||||
headers = {}
|
||||
|
||||
response = requests.request("GET", url, headers=headers, data=payload)
|
||||
|
||||
print(response.text)
|
||||
10
localAPI-main/py-examples/example-query-profile.py
Normal file
10
localAPI-main/py-examples/example-query-profile.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/user/list?page=1&page_size=100"
|
||||
|
||||
payload={}
|
||||
headers = {}
|
||||
|
||||
response = requests.request("GET", url, headers=headers, data=payload)
|
||||
|
||||
print(response.text)
|
||||
17
localAPI-main/py-examples/example-regroup-profile.py
Normal file
17
localAPI-main/py-examples/example-regroup-profile.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/user/regroup"
|
||||
|
||||
payload = {
|
||||
"user_ids": [
|
||||
"XX"
|
||||
],
|
||||
"group_id": "0"
|
||||
}
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
27
localAPI-main/py-examples/example-start-profile.py
Normal file
27
localAPI-main/py-examples/example-start-profile.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# The sample passed the test in selenium version 3.141.0
|
||||
|
||||
import requests,time
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
import sys
|
||||
|
||||
ads_id = "XXX"
|
||||
# http://local.adspower.net:50325 Script can go to Profile Management-> click Settings-> click Cache folder-> local_api file to obtain API address
|
||||
open_url = "http://local.adspower.net:50325/api/v1/browser/start?user_id=" + ads_id
|
||||
close_url = "http://local.adspower.net:50325/api/v1/browser/stop?user_id=" + ads_id
|
||||
|
||||
resp = requests.get(open_url).json()
|
||||
if resp["code"] != 0:
|
||||
print(resp["msg"])
|
||||
print("please check ads_id")
|
||||
sys.exit()
|
||||
|
||||
chrome_driver = resp["data"]["webdriver"]
|
||||
chrome_options = Options()
|
||||
chrome_options.add_experimental_option("debuggerAddress", resp["data"]["ws"]["selenium"])
|
||||
driver = webdriver.Chrome(chrome_driver, options=chrome_options)
|
||||
print(driver.title)
|
||||
driver.get("https://www.adspower.com")
|
||||
time.sleep(5)
|
||||
driver.quit()
|
||||
requests.get(close_url)
|
||||
8
localAPI-main/py-examples/example-stop-profile.py
Normal file
8
localAPI-main/py-examples/example-stop-profile.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import requests
|
||||
|
||||
profildId = 'XX'
|
||||
url = "http://local.adspower.net:50325/api/v1/browser/stop?user_id=" + profildId
|
||||
|
||||
response = requests.request("GET", url, headers={}, data={})
|
||||
|
||||
print(response.text)
|
||||
34
localAPI-main/py-examples/example-update-profile.py
Normal file
34
localAPI-main/py-examples/example-update-profile.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import requests
|
||||
|
||||
url = "http://local.adspower.net:50325/api/v1/user/update"
|
||||
|
||||
payload = {
|
||||
"user_id": "XX",
|
||||
"name": "test",
|
||||
"domain_name": "facebook.com",
|
||||
"repeat_config": [
|
||||
"0"
|
||||
],
|
||||
"open_urls": [
|
||||
"http://www.baidu.com",
|
||||
"https://www.google.com"
|
||||
],
|
||||
"country": "us",
|
||||
"remark": "remark",
|
||||
"fingerprint_config": {
|
||||
"webrtc": "proxy",
|
||||
"do_not_track": "true",
|
||||
"hardware_concurrency": "default",
|
||||
"device_memory": "default"
|
||||
},
|
||||
"user_proxy_config": {
|
||||
"proxy_soft": "no_proxy"
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, json=payload)
|
||||
|
||||
print(response.text)
|
||||
Reference in New Issue
Block a user