Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
guppy
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
Model registry
Operate
Environments
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
msemper
guppy
Commits
bef95762
Commit
bef95762
authored
11 years ago
by
Svetlana Tkachenko
Browse files
Options
Downloads
Patches
Plain Diff
Send version headers with urllib for isitup to work
parent
b40ea545
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
guppy
+1
-1
1 addition, 1 deletion
guppy
plugins/isitup.py
+7
-5
7 additions, 5 deletions
plugins/isitup.py
with
8 additions
and
6 deletions
guppy
+
1
−
1
View file @
bef95762
...
...
@@ -36,7 +36,7 @@ import time
class
main
(
object
):
def
__init__
(
self
):
# Constant.
self
.
version
=
"
0.4.
3
"
self
.
version
=
"
0.4.
4
"
self
.
homedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
print
(
"
__ _ _ _ _ __ _ __ _ _
"
)
print
(
"
/ _` | | | |
'
_ \|
'
_ \| | | | http://repo.or.cz/w/guppy.git/summary
"
)
...
...
This diff is collapsed.
Click to expand it.
plugins/isitup.py
+
7
−
5
View file @
bef95762
...
...
@@ -19,7 +19,9 @@
# MA 02110-1301, USA.
import
urllib.request
,
urllib
.
parse
,
urllib
.
error
,
json
#import urllib.request, urllib.parse, urllib.error, json
from
urllib.request
import
Request
,
urlopen
import
json
@plugin
...
...
@@ -42,10 +44,10 @@ class IsItUp(object):
url
=
args
[
0
][
8
:]
else
:
url
=
args
[
0
]
code
=
""
.
join
(
x
.
decode
(
'
utf8
'
)
for
x
in
urllib
.
request
.
urlopen
(
"
http://isitup.org/
"
+
url
+
"
.json
"
).
readlines
()
)
#
code =
code
.decode('utf8')
print
(
code
)
url
=
"
http://isitup.org/
"
+
url
+
"
.json
"
req
=
Request
(
url
,
headers
=
{
'
User-Agent
'
:
'
guppy/
'
+
self
.
server
.
config
[
"
version
"
]}
)
code
=
""
.
join
(
urlopen
(
req
).
read
()
.
decode
(
'
utf8
'
)
)
#
print(code)
arr
=
json
.
loads
(
code
)
arr
[
'
up
'
]
=
'
up
'
if
arr
[
'
status_code
'
]
==
1
else
'
not up
'
if
arr
[
'
up
'
]
==
'
up
'
:
...
...
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