summaryrefslogtreecommitdiff
path: root/docs/gl_objects
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-06-25 15:54:10 +0200
committerJohn Villalovos <john@sodarock.com>2022-06-25 09:30:03 -0700
commitf555bfb363779cc6c8f8036f6d6cfa302e15d4fe (patch)
tree328d1ec1727eb9e5a1268c046fe0e45a89d4eec5 /docs/gl_objects
parentce9216ccc542d834be7f29647c7ee98c2ca5bb01 (diff)
downloadgitlab-f555bfb363779cc6c8f8036f6d6cfa302e15d4fe.tar.gz
docs(api): document usage of head() methods
Diffstat (limited to 'docs/gl_objects')
-rw-r--r--docs/gl_objects/projects.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index 82a7430..5b0e208 100644
--- a/docs/gl_objects/projects.rst
+++ b/docs/gl_objects/projects.rst
@@ -380,7 +380,16 @@ Get a file::
# get the decoded content
print(f.decode())
-
+
+Get file details from headers, without fetching its entire content::
+
+ headers = project.files.head('README.rst', ref='main')
+
+ # Get the file size:
+ # For a full list of headers returned, see upstream documentation.
+ # https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository
+ print(headers["X-Gitlab-Size"])
+
Get a raw file::
raw_content = project.files.raw(file_path='README.rst', ref='main')