def connect(self, endpoint: str, payload: object=None) -> object:
try:
headers = {
'Authorization': 'Bearer %s' % self.api_token,
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache'
}
res = requests.post('%s%s' % (self.api_url, endpoint), headers=headers, data=payload,
proxies=self.proxy, verify=False)
return res.json()
except HTTPError:
print(sys.exc_info())
QMessageBox.critical(self, 'ERROR NOTIFICATION',
'<h3>Real-Debrid API Error</h3>' +
'A problem occurred whilst communicating with Real-Debrid. Please check your '
'Internet connection.<br/><br/>' +
'<b>ERROR LOG:</b><br/>(Error Code %s) %s<br/>%s'
% (qApp.applicationName(), HTTPError.code, HTTPError.reason), QMessageBox.Ok)
# self.exit()
评论列表
文章目录