-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest.py
69 lines (58 loc) · 1.58 KB
/
test.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# coding=utf-8
import onethingpcs
# from onethingpcs.turnsession import test_turnsession
otc = onethingpcs.otc_api()
login_status = otc.login(user="您的手机号",passwd="您的密码")
if login_status :
print("登陆成功")
else:
print("登陆失败")
### 获取远端信息
peer_status = otc.list_peer_info()
if peer_status:
print("获取成功")
print(otc.get_peer_info())
print(otc.get_peer_id())
else:
print("获取失败")
### 获取远端ID
print(otc.get_peer_id())
### 获取turn信息
result = otc.get_turn_server()
print(result)
result = otc.get_usb_info()
print(result)
result = otc.get_list_remote_download_info()
print(result)
result = otc.list_remote_download()
print(result)
t = otc.create_remote_download_task("http://www.baidu.com",file_path="/tmp",file_name="passwd")
print(t)
print(result)
# import requests
# requests.get()
# conn,session = test_turnsession.main(**result)
# # session.send_channel_data()
# # import ssl
# # cotext = ssl.create_default_context()
# # scx = cotext.wrap_socket(conn)
# # conn.send()
# print(conn.recv(1024))
# print(temp)
#
# result = otc.get_turn_server()
# temp = stun.start_turn(**result)
# print(result)
# print(temp)
### 获取远端下载列表
# dl_status = otc.list_remote_download()
# if dl_status:
# print("获取成功")
# print(otc.get_list_remote_download_info())
# else:
# print("获取失败")
### 创建下载任务
# otc.create_remote_download_task("下载地址/magnet")
#
# ### 指定下载文件地址
# otc.create_remote_download_task("下载地址/magnet",file_path="/media/sda1/onecloud/{}".format("your own path"))