[wgem] downloading suggestions from the cloud and generating a search index

This commit is contained in:
Vinícius Moreira
2019-12-16 19:50:47 -03:00
parent 813a6aa0af
commit e73e36b9c2
6 changed files with 126 additions and 186 deletions

View File

@@ -3,6 +3,7 @@ import time
import traceback
import requests
import yaml
from bauh.commons import system
@@ -59,6 +60,10 @@ class HttpClient:
res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects)
return res.json() if res else None
def get_yaml(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True):
res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects)
return yaml.safe_load(res.text) if res else None
def get_content_length(self, url: str) -> str:
"""
:param url: