def delete_endpoint(self):
if QMessageBox.question(self.view, ' ', 'Delete this endpoint?') == QMessageBox.Yes:
path = str(BASE_PATH / 'endpoints' / (urlparse(self.base_url).netloc + '.json'))
with open(path) as fd:
json = load(fd, object_pairs_hook=OrderedDict)
json.remove(self.endpoint)
with open(path, 'w') as fd:
dump(json, fd, ensure_ascii=False, indent=4)
if not json:
remove(path)
self.load_endpoints()
评论列表
文章目录