diff options
author | Frederick Muriuki Muriithi | 2022-09-09 04:43:05 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-09-09 04:43:05 +0300 |
commit | 9dd474141c968dd9b22bbb11f3b2af80b31aa530 (patch) | |
tree | e5caa1166eca91ace50f3157f2187ae96014f4bc /wqflask | |
parent | 9bc71ba5fc999e0559d30b842c56a338f394533d (diff) | |
download | genenetwork2-9dd474141c968dd9b22bbb11f3b2af80b31aa530.tar.gz |
Use `urllib.parse.urljoin` for urls
Use the `urllib.parse.urljoin` function to join urls rather than
string concatenation for uniformity.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/collect.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/partial_correlations_views.py | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index b344bd99..18f3091f 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -2,6 +2,7 @@ import hashlib import datetime import os import simplejson as json +from urllib.parse import urljoin from flask import g from flask import render_template @@ -277,7 +278,7 @@ def view_collection(): collection_info = dict( trait_obs=trait_obs, uc=uc, - heatmap_data_url=f"{GN_SERVER_URL}/heatmaps/clustered") + heatmap_data_url=urljoin(GN_SERVER_URL, "heatmaps/clustered")) if "json" in params: return json.dumps(json_version) diff --git a/wqflask/wqflask/partial_correlations_views.py b/wqflask/wqflask/partial_correlations_views.py index 91948722..b3ebc4c5 100644 --- a/wqflask/wqflask/partial_correlations_views.py +++ b/wqflask/wqflask/partial_correlations_views.py @@ -3,6 +3,7 @@ import math import requests from functools import reduce from typing import Union, Tuple +from urllib.parse import urljoin from flask import ( flash, @@ -287,7 +288,7 @@ def partial_correlations(): "with_target_db": args["with_target_db"] } return handle_response(requests.post( - url=f"{GN_SERVER_URL}/correlation/partial", + url=urljoin(GN_SERVER_URL, "correlation/partial"), json=post_data)) for error in args["errors"]: @@ -302,7 +303,7 @@ def partial_correlations(): "with_target_db": args["with_target_db"] } return handle_response(requests.post( - url=f"{GN_SERVER_URL}/correlation/partial", + url=urljoin(GN_SERVER_URL, "correlation/partial"), json=post_data)) for error in args["errors"]: @@ -347,7 +348,7 @@ def process_pcorrs_command_output(result): @app.route("/partial_correlations/<command_id>", methods=["GET"]) def poll_partial_correlation_results(command_id): response = requests.get( - url=f"{GN_SERVER_URL}/async_commands/state/{command_id}") + url=urljoin(GN_SERVER_URL, "async_commands/state/{command_id}")) if response.status_code == 200: data = response.json() |