Răsfoiți Sursa

add response status code to headers.json

Nick Sweeting 4 ani în urmă
părinte
comite
c089501073
1 a modificat fișierele cu 7 adăugiri și 1 ștergeri
  1. 7 1
      archivebox/util.py

+ 7 - 1
archivebox/util.py

@@ -200,7 +200,13 @@ def get_headers(url: str, timeout: int=None) -> str:
             stream=True
         )
     
-    return pyjson.dumps(dict(response.headers), indent=4)
+    return pyjson.dumps(
+        {
+            'Status-Code': response.status_code,
+            **dict(response.headers),
+        },
+        indent=4,
+    )
 
 
 @enforce_types