| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5082879 commit d415cc0
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,7 +142,10 @@ | |||
| 142 | 142 | # end repository tree | |
| 143 | 143 | ||
| 144 | 144 | # repository blob | |
| 145 | - file_content = p.repository_blob('master', 'README.rst') | ||
| 145 | + items = project.repository_tree(path='docs', ref='branch1') | ||
| 146 | + file_info = p.repository_blob(items[0]['id']) | ||
| 147 | + content = base64.b64decode(file_info['content']) | ||
| 148 | + size = file_info['size'] | ||
| 146 | 149 | # end repository blob | |
| 147 | 150 | ||
| 148 | 151 | # repository raw_blob | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,7 +120,7 @@ List the repository tree: | |||
| 120 | 120 | :start-after: # repository tree | |
| 121 | 121 | :end-before: # end repository tree | |
| 122 | 122 | ||
| 123 | - Get the content of a file for a commit: | ||
| 123 | + Get the content and metadata of a file for a commit, using a blob sha: | ||
| 124 | 124 | ||
| 125 | 125 | .. literalinclude:: projects.py | |
| 126 | 126 | :start-after: # repository blob | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2024,7 +2024,7 @@ def repository_tree(self, path='', ref='', **kwargs): | |||
| 2024 | 2024 | @cli.register_custom_action('Project', ('sha', )) | |
| 2025 | 2025 | @exc.on_http_error(exc.GitlabGetError) | |
| 2026 | 2026 | def repository_blob(self, sha, **kwargs): | |
| 2027 | - """Return a blob by blob SHA. | ||
| 2027 | + """Return a file by blob SHA. | ||
| 2028 | 2028 | ||
| 2029 | 2029 | Args: | |
| 2030 | 2030 | sha(str): ID of the blob | |
@@ -2035,7 +2035,7 @@ def repository_blob(self, sha, **kwargs): | |||
| 2035 | 2035 | GitlabGetError: If the server failed to perform the request | |
| 2036 | 2036 | ||
| 2037 | 2037 | Returns: | |
| 2038 | - str: The blob metadata | ||
| 2038 | + dict: The blob content and metadata | ||
| 2039 | 2039 | """ | |
| 2040 | 2040 | ||
| 2041 | 2041 | path = '/projects/%s/repository/blobs/%s' % (self.get_id(), sha) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments