Generalizes http request for json data in connectors
This commit is contained in:
parent
3a8d84e9b1
commit
5924e8ed63
3 changed files with 25 additions and 46 deletions
|
@ -206,6 +206,20 @@ def get_date(date_string):
|
|||
return None
|
||||
|
||||
|
||||
def get_data(url):
|
||||
''' wrapper for request.get '''
|
||||
resp = requests.get(
|
||||
url,
|
||||
headers={
|
||||
'Accept': 'application/activity+json; charset=utf-8',
|
||||
},
|
||||
)
|
||||
if not resp.ok:
|
||||
resp.raise_for_status()
|
||||
data = response.json()
|
||||
return data
|
||||
|
||||
|
||||
class SearchResult:
|
||||
''' standardized search result object '''
|
||||
def __init__(self, title, key, author, year):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue