Skip to content

Commit

Permalink
Update request.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoxuu authored Feb 13, 2025
1 parent 4e18a98 commit f6e43b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions generator/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ def get_data(link):
print(e.__traceback__.tb_frame.f_globals["__file__"])
print(e.__traceback__.tb_lineno)
return result

def get_json(link, params=None):
cfg = config.load()
header = {
'Accept': 'application/vnd.github.v3+json'
}
try:
r = requests.get(link,
headers=header,
params=params,
timeout=cfg['request']['timeout'],
verify=cfg['request']['ssl'])
return r.json()
except Exception as e:
print(e)
return None

0 comments on commit f6e43b4

Please sign in to comment.