Project

Profile

Help

Story #7117

closed

As a plugin writer, I can be in control when the server returns a 400+ response code

Added by bmbouter over 4 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 78
Quarter:

Description

Background

Currently the HttpDownloader will raise an exception at response.raise_for_status() anytime the server responds with a 400+ response code. The plugin writers are not in control of this.

In some cases a 404 should not raise an exception because a file being missing is normal. This is the case with pulp_rpm .treeinfo files. See https://pulp.plan.io/issues/7095 for that issue.

Proposal

Add a new hook method on HttpDownloader like this:

def raise_for_status(response):
    response.raise_for_status()

Then HttpDownloader subclasses could intercept this call and customize it.


Related issues

Blocks RPM Support - Issue #7095: Pulp 3 Sync issue (.treeinfo)CLOSED - CURRENTRELEASEActions

Also available in: Atom PDF