Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
24f42cac
Commit
24f42cac
authored
Mar 30, 2021
by
Luca Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some finishing touches
parent
44fa091e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
pull_video_data.py
src/rest-gateway/app/pull_video_data.py
+35
-4
No files found.
src/rest-gateway/app/pull_video_data.py
View file @
24f42cac
...
...
@@ -5,29 +5,48 @@ import json
videoListUrl
=
"https://dev758755.vialog.app/Videos/Meta/ListAll"
videoUrl
=
"https://dev758755.vialog.app/stat/events?type=video&id="
# token from Rest Gateway to authorize
JWT_TOKEN
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMC0xMC0wNiAwOTowNzoyMy44MjEyOTciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMTAtMDcgMDk6MDc6MjMuODIxMjk3In0.orqTjn-3J4qMM0kpreWVPkwUEtUcgoqo6wsUFxKCrwg'
def
send_transaction_to_rest_gateway
(
transaction
:
dict
):
res
=
requests
.
post
(
url
=
'https://articonf1.itec.aau.at:30401/api/trace'
,
json
=
transaction
,
headers
=
{
"Authorization"
:
f
"Bearer {JWT_TOKEN}"
},
verify
=
False
# ignore ssl error
)
print
(
res
)
videosRequest
=
requests
.
get
(
videoListUrl
)
test
=
set
()
empty
=
set
()
html
=
set
()
if
(
videosRequest
.
status_code
!=
200
):
print
(
f
"Status: {videosRequest.status_code}"
)
dataCount
=
0
for
video
in
videosRequest
.
json
():
dataCount
+=
1
id
=
video
[
"videoId"
]
videoRequest
=
requests
.
get
(
f
"{videoUrl}{id}"
)
if
videoRequest
.
status_code
!=
200
:
print
(
f
"Status: {videoRequest.status_code}"
)
if
videoRequest
.
text
!=
""
:
if
videoRequest
.
text
!=
""
and
not
videoRequest
.
text
.
startswith
(
"<!DOCTYPE html>"
)
:
print
(
f
"
\n\n
{videoUrl}{id}
\n
{videoRequest.text}"
)
historyList
=
sorted
(
videoRequest
.
json
()[
0
][
"History"
],
key
=
lambda
k
:
k
[
'moderationDate'
],
reverse
d
=
True
)
historyList
=
sorted
(
videoRequest
.
json
()[
0
][
"History"
],
key
=
lambda
k
:
k
[
'moderationDate'
],
reverse
=
True
)
i
=
0
changeList
=
[]
for
eventMap
in
historyList
:
if
i
==
0
:
lastState
=
eventMap
lastState
[
"AppicationType"
]
=
"vialog"
lastState
[
"docType"
]
=
"vialog-video"
#send_transaction_to_rest_gateway(lastState)
print
(
lastState
)
if
eventMap
[
"eventName"
]
==
'r1eabcbdc8f5378b2ba71a1b6fe2038b Created'
or
eventMap
[
"eventName"
]
==
'Created'
:
...
...
@@ -63,9 +82,21 @@ for video in videosRequest.json():
change
=
{
"changeType"
:
"CustomLabel"
,
"changedValue"
:
"label"
,
"previousValue"
:
historyList
[
i
-
1
][
"label"
],
"newValue"
:
eventMap
[
"label"
]}
print
(
change
)
change
[
"videoId"
]
=
id
change
[
"timestamp"
]
=
eventMap
[
"moderationDate"
]
change
[
"ApplicationType"
]
=
"vialog"
change
[
"docType"
]
=
"vialog-change"
#send_transaction_to_rest_gateway(change)
i
+=
1
elif
videoRequest
.
text
==
""
:
empty
.
add
(
id
)
else
:
html
.
add
(
id
)
print
(
test
)
print
(
f
"empty: {empty}
\n\n
"
)
print
(
f
"html page: {html}
\n\n
"
)
print
(
dataCount
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment