Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
9f3a6911
Commit
9f3a6911
authored
May 10, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update stats scripts to python3
parent
94c2fe50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
url_stats.py
web/url_stats.py
+8
-8
url_stats_project.py
web/url_stats_project.py
+8
-8
No files found.
web/url_stats.py
View file @
9f3a6911
#!/usr/bin/env python
#!/usr/bin/env python
3
import
sys
...
...
@@ -6,7 +6,7 @@ urls = {}
try
:
while
1
:
line
=
raw_
input
()
line
=
input
()
line_arr
=
line
.
split
(
" "
)
try
:
host
=
line_arr
[
-
1
]
...
...
@@ -20,13 +20,13 @@ try:
try
:
urls
[
host
+
url
]
=
(
urls
[
host
+
url
][
0
]
+
t
,
urls
[
host
+
url
][
1
]
+
1
)
except
KeyError
,
e
:
except
KeyError
:
urls
[
host
+
url
]
=
(
t
,
1
)
except
ValueError
,
e
:
except
ValueError
:
pass
except
EOFError
,
e
:
except
EOFError
:
pass
def
sort_by_value
(
d
):
...
...
@@ -41,9 +41,9 @@ if (len(sys.argv) > 1):
for
k
in
f
.
readlines
():
k
=
k
.
strip
()
try
:
print
urls
[
k
][
0
],
urls
[
k
][
1
],
urls
[
k
][
0
]
/
urls
[
k
][
1
],
k
print
(
urls
[
k
][
0
],
urls
[
k
][
1
],
urls
[
k
][
0
]
/
urls
[
k
][
1
],
k
)
except
:
print
0
,
0
,
k
print
(
0
,
0
,
k
)
else
:
i
=
0
alltime
=
0
...
...
@@ -56,6 +56,6 @@ else:
i
=
0
for
k
in
sort_by_value
(
urls
):
print
round
(
urls
[
k
][
0
]
*
100
/
alltime
,
0
),
urls
[
k
][
0
],
urls
[
k
][
1
],
round
(
urls
[
k
][
0
]
*
1000
/
urls
[
k
][
1
],
0
),
k
print
(
round
(
urls
[
k
][
0
]
*
100
/
alltime
,
0
),
urls
[
k
][
0
],
urls
[
k
][
1
],
round
(
urls
[
k
][
0
]
*
1000
/
urls
[
k
][
1
],
0
),
k
)
i
+=
1
if
i
>
100
:
break
web/url_stats_project.py
View file @
9f3a6911
#!/usr/bin/env python
#!/usr/bin/env python
3
import
sys
...
...
@@ -6,7 +6,7 @@ urls = {}
try
:
while
1
:
line
=
raw_
input
()
line
=
input
()
line_arr
=
line
.
split
(
" "
)
try
:
host
=
line_arr
[
-
1
]
...
...
@@ -21,13 +21,13 @@ try:
try
:
urls
[
host
+
url
]
=
(
urls
[
host
+
url
][
0
]
+
t
,
urls
[
host
+
url
][
1
]
+
1
)
except
KeyError
,
e
:
except
KeyError
:
urls
[
host
+
url
]
=
(
t
,
1
)
except
ValueError
,
e
:
except
ValueError
:
pass
except
EOFError
,
e
:
except
EOFError
:
pass
def
sort_by_value
(
d
):
...
...
@@ -42,9 +42,9 @@ if (len(sys.argv) > 1):
for
k
in
f
.
readlines
():
k
=
k
.
strip
()
try
:
print
urls
[
k
][
0
],
urls
[
k
][
1
],
urls
[
k
][
0
]
/
urls
[
k
][
1
],
k
print
(
urls
[
k
][
0
],
urls
[
k
][
1
],
urls
[
k
][
0
]
/
urls
[
k
][
1
],
k
)
except
:
print
0
,
0
,
k
print
(
0
,
0
,
k
)
else
:
i
=
0
alltime
=
0
...
...
@@ -57,6 +57,6 @@ else:
i
=
0
for
k
in
sort_by_value
(
urls
):
print
round
(
urls
[
k
][
0
]
*
100
/
alltime
,
0
),
urls
[
k
][
0
],
urls
[
k
][
1
],
round
(
urls
[
k
][
0
]
*
1000
/
urls
[
k
][
1
],
0
),
k
print
(
round
(
urls
[
k
][
0
]
*
100
/
alltime
,
0
),
urls
[
k
][
0
],
urls
[
k
][
1
],
round
(
urls
[
k
][
0
]
*
1000
/
urls
[
k
][
1
],
0
),
k
)
i
+=
1
if
i
>
100
:
break
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