Skip to content

Commit

Permalink
prepare for github release patcher plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-MrBeam committed May 11, 2022
1 parent d855231 commit afc5a98
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions octoprint_mrbeam/software_update_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from octoprint_mrbeam.mrb_logger import mrb_logger
from octoprint_mrbeam.util import dict_merge, logExceptions
from octoprint_mrbeam.util.github_api import get_file_of_repo_for_tag
from octoprint_mrbeam.util.github_api import get_file_of_repo_for_tag, REPO_URL
from util.pip_util import get_version_of_pip_module


Expand Down Expand Up @@ -96,7 +96,8 @@ def get_tag_of_github_repo(repo):
import json

try:
url = "https://api.github.com/repos/mrbeam/{repo}/tags".format(repo=repo)
url = "{repo_url}/tags".format(repo_url=REPO_URL.format(repo=repo))

headers = {
"Accept": "application/json",
}
Expand Down
1 change: 1 addition & 0 deletions octoprint_mrbeam/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import threading

from .log import logExceptions, logtime, logme
from . import github_api

if sys.version_info >= (3,):
_basestring = str
Expand Down
8 changes: 4 additions & 4 deletions octoprint_mrbeam/util/github_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import json

_logger = mrb_logger("octoprint.plugins.mrbeam.util.github_api")

REPO_URL = "https://api.github.com/repos/mrbeam/{repo}"

def get_file_of_repo_for_tag(file, repo, tag):
"""
Expand All @@ -27,8 +27,8 @@ def get_file_of_repo_for_tag(file, repo, tag):
content of file
"""
try:
url = "https://api.github.com/repos/mrbeam/{repo}/contents/{file}?ref={tag}".format(
repo=repo, file=file, tag=tag
url = "{repo_url}/contents/{file}?ref={tag}".format(
repo_url=REPO_URL.format(repo=repo), file=file, tag=tag
)

headers = {
Expand All @@ -46,7 +46,7 @@ def get_file_of_repo_for_tag(file, repo, tag):
_logger.warning("timeout while trying to get the file")
return None
except ConnectionError:
_logger.warning("connection error while trying to get the file")
_logger.warning("connection error while trying to get the file {}".format(url))
return None

if response:
Expand Down

0 comments on commit afc5a98

Please sign in to comment.