Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
95b418a3
Commit
95b418a3
authored
9 years ago
by
Pavel Kácha
Browse files
Options
Downloads
Patches
Plain Diff
Syntax compatibility with Python 3 (thx to Radko Krkos)
parent
35826c86
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
warden3/warden_client/warden_client.py
+1
-1
1 addition, 1 deletion
warden3/warden_client/warden_client.py
warden3/warden_client/warden_client_examples.py
+12
-11
12 additions, 11 deletions
warden3/warden_client/warden_client_examples.py
with
13 additions
and
12 deletions
warden3/warden_client/warden_client.py
+
1
−
1
View file @
95b418a3
...
@@ -14,7 +14,7 @@ from os import path
...
@@ -14,7 +14,7 @@ from os import path
from
operator
import
itemgetter
from
operator
import
itemgetter
from
sys
import
version_info
from
sys
import
version_info
fix_logging_filename
=
str
if
version_info
<
(
2
,
7
)
else
lambda
(
x
)
:
x
fix_logging_filename
=
str
if
version_info
<
(
2
,
7
)
else
lambda
x
:
x
VERSION
=
"
3.0-beta2
"
VERSION
=
"
3.0-beta2
"
...
...
This diff is collapsed.
Click to expand it.
warden3/warden_client/warden_client_examples.py
+
12
−
11
View file @
95b418a3
...
@@ -106,7 +106,7 @@ def gen_random_idea(client_name="cz.example.warden.test"):
...
@@ -106,7 +106,7 @@ def gen_random_idea(client_name="cz.example.warden.test"):
"
Size
"
:
46
,
"
Size
"
:
46
,
"
Ref
"
:
[
"
cve:CVE-%s-%s
"
%
(
randstr
(
string
.
digits
,
4
),
randstr
())],
"
Ref
"
:
[
"
cve:CVE-%s-%s
"
%
(
randstr
(
string
.
digits
,
4
),
randstr
())],
"
ContentEncoding
"
:
"
base64
"
,
"
ContentEncoding
"
:
"
base64
"
,
"
Content
"
:
b64encode
(
randstr
())
"
Content
"
:
b64encode
(
randstr
(
maxlen
=
128
*
1024
))
}
}
],
],
"
Node
"
:
[
"
Node
"
:
[
...
@@ -139,7 +139,7 @@ def main():
...
@@ -139,7 +139,7 @@ def main():
# idstore="MyClient.id",
# idstore="MyClient.id",
# name="cz.example.warden.test")
# name="cz.example.warden.test")
print
"
=== Debug ===
"
print
(
"
=== Debug ===
"
)
info
=
wclient
.
getDebug
()
info
=
wclient
.
getDebug
()
pprint
(
info
)
pprint
(
info
)
...
@@ -150,18 +150,18 @@ def main():
...
@@ -150,18 +150,18 @@ def main():
# If you want just to be informed, this is not necessary, just
# If you want just to be informed, this is not necessary, just
# configure logging correctly and check logs.
# configure logging correctly and check logs.
if
isinstance
(
info
,
Error
):
if
isinstance
(
info
,
Error
):
print
info
print
(
info
)
print
"
=== Server info ===
"
print
(
"
=== Server info ===
"
)
info
=
wclient
.
getInfo
()
info
=
wclient
.
getInfo
()
print
"
=== Sending 10 event(s) ===
"
print
(
"
=== Sending 10 event(s) ===
"
)
start
=
time
()
start
=
time
()
ret
=
wclient
.
sendEvents
([
gen_random_idea
(
client_name
=
wclient
.
name
)
for
i
in
range
(
10
)])
ret
=
wclient
.
sendEvents
([
gen_random_idea
(
client_name
=
wclient
.
name
)
for
i
in
range
(
10
)])
print
ret
print
(
ret
)
print
"
Time: %f
"
%
(
time
()
-
start
)
print
(
"
Time: %f
"
%
(
time
()
-
start
)
)
print
"
=== Getting 10 events ===
"
print
(
"
=== Getting 10 events ===
"
)
start
=
time
()
start
=
time
()
# cat = ['Availability', 'Abusive.Spam','Attempt.Login']
# cat = ['Availability', 'Abusive.Spam','Attempt.Login']
...
@@ -181,11 +181,12 @@ def main():
...
@@ -181,11 +181,12 @@ def main():
group
=
[]
group
=
[]
nogroup
=
[]
nogroup
=
[]
ret
=
wclient
.
getEvents
(
count
=
0
,
id
=
0
,
cat
=
cat
,
nocat
=
nocat
,
tag
=
tag
,
notag
=
notag
,
group
=
group
,
nogroup
=
nogroup
)
ret
=
wclient
.
getEvents
(
count
=
10
,
cat
=
cat
,
nocat
=
nocat
,
tag
=
tag
,
notag
=
notag
,
group
=
group
,
nogroup
=
nogroup
)
ret
=
wclient
.
getEvents
(
count
=
10
,
cat
=
cat
,
nocat
=
nocat
,
tag
=
tag
,
notag
=
notag
,
group
=
group
,
nogroup
=
nogroup
)
print
"
Time: %f
"
%
(
time
()
-
start
)
print
(
"
Time: %f
"
%
(
time
()
-
start
)
)
print
"
Got %i events
"
%
len
(
ret
)
print
(
"
Got %i events
"
%
len
(
ret
)
)
for
e
in
ret
:
for
e
in
ret
:
print
e
.
get
(
"
Category
"
),
e
.
get
(
"
Node
"
)[
0
].
get
(
"
Type
"
),
e
.
get
(
"
Node
"
)[
0
].
get
(
"
Name
"
)
print
(
e
.
get
(
"
Category
"
),
e
.
get
(
"
Node
"
)[
0
].
get
(
"
Type
"
),
e
.
get
(
"
Node
"
)[
0
].
get
(
"
Name
"
)
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment