Skip to content

Commit

Permalink
Bumped acceptable timeout limit for Wago API
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed May 23, 2021
1 parent 19293e5 commit 271726e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CB/Wago.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def check_updates(self, addon):
payload = requests.get(f'https://data.wago.io/api/check/{addon.api}?ids='
f'{",".join(quote_plus(item) for item in addon.list.keys())}',
headers={'api-key': self.apiKey, 'User-Agent': HEADERS['User-Agent']},
timeout=5).json()
timeout=15).json()
if 'error' in payload or 'msg' in payload:
raise RuntimeError
for entry in payload:
Expand All @@ -147,12 +147,12 @@ def check_stash(self, addon):
payload = requests.get(f'https://data.wago.io/api/check/{addon.api}?ids='
f'{",".join(quote_plus(item) for item in self.stash)}',
headers={'api-key': self.apiKey, 'User-Agent': HEADERS['User-Agent']},
timeout=5).json()
timeout=15).json()
for entry in payload:
output.append(entry['name'])
raw = requests.get(f'https://data.wago.io/api/raw/encoded?id={quote_plus(entry["slug"])}',
headers={'api-key': self.apiKey, 'User-Agent': HEADERS['User-Agent']},
timeout=5).text
timeout=15).text
stash = f' ["{entry["slug"]}"] = {{\n name = [=[{entry["name"]}]=],\n ' \
f'author = [=[{entry["username"]}]=],\n encoded = [=[{raw}]=],\n ' \
f'wagoVersion = [=[{entry["version"]}]=],\n ' \
Expand All @@ -173,7 +173,7 @@ def parse_changelog(self, entry):
@retry('Failed to parse Wago data.')
def update_entry(self, entry, addon):
raw = requests.get(f'https://data.wago.io/api/raw/encoded?id={quote_plus(entry["slug"])}',
headers={'api-key': self.apiKey, 'User-Agent': HEADERS['User-Agent']}, timeout=5).text
headers={'api-key': self.apiKey, 'User-Agent': HEADERS['User-Agent']}, timeout=15).text
slug = f' ["{entry["slug"]}"] = {{\n name = [=[{entry["name"]}]=],\n author = [=[' \
f'{entry["username"]}]=],\n encoded = [=[{raw}]=],\n wagoVersion = [=[' \
f'{entry["version"]}]=],\n wagoSemver = [=[{entry["versionString"]}]=],\n ' \
Expand Down

0 comments on commit 271726e

Please sign in to comment.