Skip to content

Commit dcb72b3

Browse files
authored
Merge pull request sigmavirus24#799 from sigmavirus24/bug/798
Handle 304 responses from GitHub when users pass etag
2 parents bf44c16 + d6c2a1c commit dcb72b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

github3/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ def _json(self, response, expected_status_code, include_cache_info=True):
154154
if actual_status_code != expected_status_code:
155155
if actual_status_code >= 400:
156156
raise exceptions.error_for(response)
157+
158+
if actual_status_code == 304:
159+
# Received a response from someone passing in `etag=`
160+
return None
161+
157162
LOG.warning('Expected status_code %d but got %d',
158163
expected_status_code,
159164
actual_status_code)
165+
160166
try:
161167
ret = response.json()
162168
except ValueError:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy