FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
api-examples/python/devices_get_all.py at master · R-Vision/api-examples · GitHub
R-Vision
/
api-examples
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Issues
0
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
api-examples
/
python
/
devices_get_all.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (45 loc) · 1.36 KB
Breadcrumbs
api-examples
/
python
/
devices_get_all.py
Copy path
File metadata and controls
57 lines (45 loc) · 1.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import
json
import
requests
PROTOCOL
=
'http'
# or https
RVISION
=
'127.0.0.1'
# ip or hostname
USERNAME
=
'admin'
# any user login
PASSWORD
=
'admin'
requests
.
packages
.
urllib3
.
disable_warnings
()
s
=
requests
.
Session
()
# Авторизируемся
login
=
s
.
post
(
PROTOCOL
+
'://'
+
RVISION
+
'/login'
,
data
=
{
'username'
:
USERNAME
,
'password'
:
PASSWORD
},
verify
=
False
)
loginResult
=
login
.
json
()
# Применяем пагинацию и лимит
devicesParams
=
{
'page'
:
1
,
# Пагинация, номер страницы
'start'
:
0
,
# Пагинация, позиция элемента с которого начать поиск
'limit'
:
10
# Сколько всего выводить
}
# Следующая страница
# devicesParams = {
# 'page': 2,
# 'start': 10,
# 'limit': 10
# }
# Вывести все (может быть очень долго)
# devicesParams = {
# 'page': 1,
# 'start': 0,
# 'limit': 999999 # Итоговое количество может быть ограничено лицензией
# }
devices
=
s
.
get
(
PROTOCOL
+
'://'
+
RVISION
+
'/api/v1/am/devices'
,
params
=
devicesParams
,
verify
=
False
)
devicesResult
=
devices
.
json
()
print
json
.
dumps
(
devicesResult
,
indent
=
2
,
sort_keys
=
True
,
ensure_ascii
=
False
)
Back
|
FazBrowse Home
|
New Git URL