Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
url-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
url-checker
Commits
20f34867
Commit
20f34867
authored
Oct 17, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not loop by default.
parent
7479fca7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
urlchecker_http.py
urlchecker_http.py
+13
-4
No files found.
urlchecker_http.py
View file @
20f34867
...
...
@@ -26,7 +26,7 @@ class BotError(Exception):
class
WebBot
:
def
__init__
(
self
):
self
.
config
=
configparser
.
ConfigParser
(
empty_lines_in_values
=
False
)
self
.
config
[
CONFIG_SECTION
]
=
{
"INTERVAL"
:
60
}
self
.
config
[
CONFIG_SECTION
]
=
{
"INTERVAL"
:
-
1
}
def
initDB
(
self
,
sqlite_path
):
self
.
_db
=
LogDB
(
sqlite_path
)
...
...
@@ -98,7 +98,12 @@ class WebBot:
# Get the list of available IPv4 frontend CDN
hostname
=
parsed_url
.
hostname
dns_info_list
=
socket
.
getaddrinfo
(
hostname
,
"http"
,
socket
.
AF_INET
)
try
:
dns_info_list
=
socket
.
getaddrinfo
(
hostname
,
"http"
,
socket
.
AF_INET
)
except
socket
.
gaierror
:
dns_info_list
=
[]
ip_list
=
[
x
[
4
][
0
]
for
x
in
dns_info_list
]
for
ip
in
ip_list
:
...
...
@@ -149,8 +154,8 @@ class WebBot:
u
=
miniupnpc
.
UPnP
()
u
.
discoverdelay
=
200
u
.
discover
()
u
.
selectigd
()
try
:
u
.
selectigd
()
print
(
"external ip: {}"
.
format
(
u
.
externalipaddress
()))
except
Exception
:
pass
...
...
@@ -159,7 +164,11 @@ class WebBot:
try
:
while
self
.
_running
:
self
.
iterateLoop
()
time
.
sleep
(
self
.
config
.
getint
(
CONFIG_SECTION
,
"INTERVAL"
))
interval
=
self
.
config
.
getint
(
CONFIG_SECTION
,
"INTERVAL"
)
if
interval
<
0
:
self
.
stop
()
else
:
time
.
sleep
(
interval
)
except
KeyboardInterrupt
:
self
.
stop
()
except
:
...
...
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