From 29150bd57c14b0b93f7f627085865b9da7f556d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karatu=C4=9F=20Ozan=20Bircan?= Date: Fri, 22 Mar 2024 17:04:50 +0000 Subject: [PATCH] fix: Don't use cached response (#33) * fix: Set cache control as no-cache * chore: Bump version to 1.0.13 --- gwas_sumstats_tools/utils.py | 7 ++++++- pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gwas_sumstats_tools/utils.py b/gwas_sumstats_tools/utils.py index 2944a40..d08f073 100755 --- a/gwas_sumstats_tools/utils.py +++ b/gwas_sumstats_tools/utils.py @@ -59,11 +59,16 @@ def download_with_requests(url, Arguments: url -- request url params -- requests parameters - headers -- request headers + headers -- request headers, modified to include cache-control Return: Content from URL if status code is 200 or None """ + if headers is None: + headers = {} + + headers.update({'Cache-Control': 'no-cache', 'Pragma': 'no-cache'}) + s = requests.Session() retries = Retry(total=5, backoff_factor=2, status_forcelist=[429, 500, 502, 503, 504]) s.mount(url, HTTPAdapter(max_retries=retries)) diff --git a/pyproject.toml b/pyproject.toml index d94f305..bcb28ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gwas-sumstats-tools" -version = "1.0.12" +version = "1.0.13" description = "" authors = ["jdhayhurst "] readme = "README.md"