From b0dfd84d7d0252a8f10bbe74a14318358552cc2c Mon Sep 17 00:00:00 2001 From: Simone Del Zotto Date: Thu, 14 Mar 2024 12:08:05 +0100 Subject: [PATCH 1/3] Add User-Agent heder to avoid 403 Forbidden error when downloading metada from poste.it --- src/djangosaml2_spid/management/commands/update_idps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/djangosaml2_spid/management/commands/update_idps.py b/src/djangosaml2_spid/management/commands/update_idps.py index 395e178..1a26190 100644 --- a/src/djangosaml2_spid/management/commands/update_idps.py +++ b/src/djangosaml2_spid/management/commands/update_idps.py @@ -64,7 +64,8 @@ def download_identity_providers(self): indentation_level=1, ) - with requests.get(idp_metadata_url, verify=True) as response: + #Add User-Agent heder to avoid 403 Forbidden error when downloading metada from poste.it + with requests.get(idp_metadata_url, verify=True, headers={'User-Agent': ''}) as response: identity_provider["metadata"] = response.text self.print_success("All IdPs metadata downloaded successfully") From ccd7f840ac30087137cb2d096949543e639a0803 Mon Sep 17 00:00:00 2001 From: Simone Del Zotto Date: Thu, 14 Mar 2024 12:14:43 +0100 Subject: [PATCH 2/3] Add User-Agent heder to avoid 403 Forbidden error when downloading metadata from poste.it --- src/djangosaml2_spid/management/commands/update_idps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/djangosaml2_spid/management/commands/update_idps.py b/src/djangosaml2_spid/management/commands/update_idps.py index 1a26190..8603223 100644 --- a/src/djangosaml2_spid/management/commands/update_idps.py +++ b/src/djangosaml2_spid/management/commands/update_idps.py @@ -64,7 +64,7 @@ def download_identity_providers(self): indentation_level=1, ) - #Add User-Agent heder to avoid 403 Forbidden error when downloading metada from poste.it + #Add User-Agent heder to avoid 403 Forbidden error when downloading metadata from poste.it with requests.get(idp_metadata_url, verify=True, headers={'User-Agent': ''}) as response: identity_provider["metadata"] = response.text From f3e1f7bb2d8425f98873b09fb0ca86c188082c31 Mon Sep 17 00:00:00 2001 From: Simone Del Zotto Date: Thu, 14 Mar 2024 12:15:08 +0100 Subject: [PATCH 3/3] Add User-Agent header to avoid 403 Forbidden error when downloading metadata from poste.it --- src/djangosaml2_spid/management/commands/update_idps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/djangosaml2_spid/management/commands/update_idps.py b/src/djangosaml2_spid/management/commands/update_idps.py index 8603223..96344ea 100644 --- a/src/djangosaml2_spid/management/commands/update_idps.py +++ b/src/djangosaml2_spid/management/commands/update_idps.py @@ -64,7 +64,7 @@ def download_identity_providers(self): indentation_level=1, ) - #Add User-Agent heder to avoid 403 Forbidden error when downloading metadata from poste.it + #Add User-Agent header to avoid 403 Forbidden error when downloading metadata from poste.it with requests.get(idp_metadata_url, verify=True, headers={'User-Agent': ''}) as response: identity_provider["metadata"] = response.text