From 69e42f3c5f0fa9dce73b0c885fafffab1fe0bcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 29 Dec 2021 16:31:26 +0100 Subject: [PATCH] fix: POST for ipasnhistory via bgpranking works again --- website/web/genericapi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/web/genericapi.py b/website/web/genericapi.py index abe9b91..dc9744b 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -36,19 +36,20 @@ class IPASNProxy(Resource): full_path = request.full_path[:-1] else: full_path = request.full_path - path_for_ipasnhistory = full_path.replace('/ipasn_history', '') + path_for_ipasnhistory = full_path.replace('/ipasn_history/', '') if path_for_ipasnhistory.startswith('/?'): path_for_ipasnhistory = path_for_ipasnhistory.replace('/?', '/ip?') + if not path_for_ipasnhistory: + path_for_ipasnhistory = 'ip' return urljoin(get_config('generic', 'ipasnhistory_url'), path_for_ipasnhistory) def get(self, path=''): url = self._proxy_url() - print(url) return requests.get(url).json() def post(self, path=''): url = self._proxy_url() - return requests.post(url, data=request.data).json() + return requests.post(url, json=request.data.decode()).json() # TODO: Add other parameters for asn_rank