Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Seedbox-Statistics-For-InfluxDB
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
Seedbox-Statistics-For-InfluxDB
Commits
8619de9c
Commit
8619de9c
authored
8 years ago
by
Matt
Browse files
Options
Downloads
Patches
Plain Diff
Moved HTTP requests into 1 method to cleanup exception handling
parent
9a5e22a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients/deluge.py
+5
-9
5 additions, 9 deletions
clients/deluge.py
with
5 additions
and
9 deletions
clients/deluge.py
+
5
−
9
View file @
8619de9c
from
clients.torrentclient
import
TorrentClient
from
urllib.request
import
Request
,
urlopen
,
URLError
from
urllib.request
import
Request
,
urlopen
,
URLError
import
json
import
json
import
sys
import
sys
import
gzip
import
gzip
from
clients.torrentclient
import
TorrentClient
class
DelugeClient
(
TorrentClient
):
class
DelugeClient
(
TorrentClient
):
...
@@ -21,7 +22,7 @@ class DelugeClient(TorrentClient):
...
@@ -21,7 +22,7 @@ class DelugeClient(TorrentClient):
Add common headers needed to make the API requests
Add common headers needed to make the API requests
:return: request
:return: request
"""
"""
# TODO pass this to parent
self
.
send_log
(
'
Adding headers to request
'
,
'
debug
'
)
self
.
send_log
(
'
Adding headers to request
'
,
'
debug
'
)
headers
=
{
headers
=
{
...
@@ -29,13 +30,10 @@ class DelugeClient(TorrentClient):
...
@@ -29,13 +30,10 @@ class DelugeClient(TorrentClient):
'
Accept
'
:
'
application/json
'
'
Accept
'
:
'
application/json
'
}
}
for
k
,
v
in
headers
.
items
():
req
.
add_header
(
k
,
v
)
if
self
.
session_id
:
if
self
.
session_id
:
req
.
add_
header
(
'
Cookie
'
,
self
.
session_id
)
header
s
[
'
Cookie
'
]
=
self
.
session_id
return
req
return
TorrentClient
.
_add_common_headers
(
self
,
req
,
headers
=
headers
)
def
_check_session
(
self
):
def
_check_session
(
self
):
"""
"""
...
@@ -68,7 +66,6 @@ class DelugeClient(TorrentClient):
...
@@ -68,7 +66,6 @@ class DelugeClient(TorrentClient):
:return:
:return:
"""
"""
# TODO Validate method and params
data
=
json
.
dumps
({
data
=
json
.
dumps
({
'
id
'
:
self
.
request_id
,
'
id
'
:
self
.
request_id
,
'
method
'
:
method
,
'
method
'
:
method
,
...
@@ -194,7 +191,6 @@ class DelugeClient(TorrentClient):
...
@@ -194,7 +191,6 @@ class DelugeClient(TorrentClient):
print(e)
print(e)
"""
"""
def
get_active_plugins
(
self
):
def
get_active_plugins
(
self
):
"""
"""
Return all active plugins
Return all active plugins
...
...
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