-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from StuffAnThings/develop
v3.1.2
- Loading branch information
Showing
12 changed files
with
756 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ venv | |
.idea | ||
.venv | ||
test.py | ||
!config/config.yml.sample | ||
!config/config.yml.sample | ||
.flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[flake8] | ||
ignore = | ||
E226, # E226 Missing whitespace around arithmetic operator | ||
#E302, # E302 Expected 2 blank lines, found 0 | ||
E401, # E401 Multiple imports on one line | ||
E701, # E701 Multiple statements on one line (colon) | ||
E241, # E241 Multiple spaces after ',' | ||
E272, # E272 Multiple spaces before keyword | ||
C901 # C901 Function is too complex | ||
E722 # E722 Do not use bare except, specify exception instead | ||
max-line-length = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.1.1 | ||
3.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import logging | ||
|
||
from modules.util import Failed | ||
|
||
logger = logging.getLogger("qBit Manage") | ||
|
||
|
||
class Apprise: | ||
def __init__(self, config, params): | ||
self.config = config | ||
self.api_url = params["api_url"] | ||
self.notify_url = ",".join(params["notify_url"]) | ||
response = self.config.get(self.api_url) | ||
if response.status_code != 200: | ||
raise Failed(f"Apprise Error: Unable to connect to Apprise using {self.api_url}") | ||
raise Failed(f"Apprise Error: Unable to connect to Apprise using {self.api_url}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
from modules.util import Failed | ||
from json import JSONDecodeError | ||
|
||
logger = logging.getLogger("qBit Manage") | ||
base_url = "https://beyond-hd.me/api/" | ||
|
||
|
||
class BeyondHD: | ||
def __init__(self, config, params): | ||
self.config = config | ||
self.apikey = params["apikey"] | ||
json = {"search": "test"} | ||
self.search(json) | ||
|
||
def search(self, json, path="torrents/"): | ||
url = f"{base_url}{path}{self.apikey}" | ||
json["action"] = "search" | ||
if self.config.trace_mode: | ||
logger.debug(url.replace(self.apikey, "APIKEY")) | ||
logger.debug(f"JSON: {json}") | ||
try: | ||
response = self.config.post(url, json=json) | ||
response_json = response.json() | ||
except JSONDecodeError as e: | ||
if response.status_code >= 400: | ||
raise Failed(e) | ||
if response.status_code >= 400: | ||
logger.debug(f"Response: {response_json}") | ||
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}") | ||
if not response_json["success"]: | ||
raise Failed(f"BHD Error: {response_json['status_message']}") | ||
return response.json() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.