Skip to content

Commit

Permalink
Add User-Agent heder to avoid 403 Forbidden error when downloading me…
Browse files Browse the repository at this point in the history
…tada from poste.it
  • Loading branch information
delzotto committed Mar 14, 2024
1 parent 43998c9 commit b0dfd84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/djangosaml2_spid/management/commands/update_idps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit b0dfd84

Please sign in to comment.