diff --git a/checks/utils/fetchers.py b/checks/utils/fetchers.py index ca3ad65..5bcab0c 100644 --- a/checks/utils/fetchers.py +++ b/checks/utils/fetchers.py @@ -15,7 +15,7 @@ def matchGist(url): def getGist(inputUrl): API_URL = "https://api.github.com" gistId = inputUrl - return requests.get('{0}/gists/{1}'.format(API_URL, gistId)).json() + return requests.get('{0}/gists/{1}'.format(API_URL, gistId), timeout=5, allow_redirects=False).json() def getLinesGist(gistObject): @@ -41,7 +41,7 @@ def matchHaste(url): def getHaste(hasteId): API_URL = "https://hastebin.com" - return requests.get('{0}/documents/{1}'.format(API_URL, hasteId)).json() + return requests.get('{0}/documents/{1}'.format(API_URL, hasteId), timeout=5, allow_redirects=False).json() def getLinesHaste(hasteObject): @@ -63,7 +63,8 @@ def matchObs(url): def getObslog(obsURL, obslogId): - return requests.get('{0}/{1}'.format(obsURL, obslogId)).text + obsURL = obsURL.replace("www.", "") + return requests.get('{0}/{1}'.format(obsURL, obslogId), timeout=5, allow_redirects=False).text def getLinesObslog(obslogText): @@ -81,7 +82,7 @@ def matchPastebin(url): def getRawPaste(obslogId): API_URL = "https://pastebin.com/raw" - return requests.get('{0}/{1}'.format(API_URL, obslogId)).text + return requests.get('{0}/{1}'.format(API_URL, obslogId), timeout=5, allow_redirects=False).text def getLinesPaste(obslogText): @@ -99,7 +100,7 @@ def matchDiscord(url): def getRawDiscord(obslogId): API_URL = "https://cdn.discordapp.com/attachments" - resp = requests.get('{0}/{1}'.format(API_URL, obslogId)) + resp = requests.get('{0}/{1}'.format(API_URL, obslogId), timeout=5, allow_redirects=False) if resp.status_code == 200: return resp.text return ""