Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions checks/utils/fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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
Comment thread
RytoEX marked this conversation as resolved.


def getLinesObslog(obslogText):
Expand All @@ -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):
Expand All @@ -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 ""
Expand Down