New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to get raw format of a ContentFile? #576
Comments
|
Have you tried this: f = repo.get_file_contents("/path/to/file", ref)
raw_data = f.decoded_content |
No idea; I'm just a user, like you. Seems like the dev may be away (temporarily?), given how many open PRs there are that haven't gotten any responses. |
Documentation needs updates. |
@davidxia As you also suffered from the lacking docs, then this issue should have not been closed, IMO Two years later, the page is still silent about |
I'm also reading this just now, and its very useful, it gets me the file text content. |
Documentation PR welcome |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi stale_bot ! Thx to you to don't close this issue, we really need this documentation update. ;) |
+1ing this, faced the same issue and stumbled on this issue via search |
Is this good enough to address PyGithub#576 ?
Hi @thomas-bouhon , @abhn -- I submitted a PR couple of months ago for this issue. Now stale_bot has marked it as stale -- would you know how can we get my PR reviewed so it can be merged before it is closed by stale_bot? |
@hostingthepage Although I'm not an active contributor, I don't mind any motion for sustainable development of any project I use or contribute to. |
My comment doesn't solve the docs issue... Anyway I always "lookup" attributes/methods of a given object if in doubt, in case the docs are missing (like the issue here), or I'm just lazy etc. so given this code: repo = g.get_repo("whatever/here")
data = repo.get_contents("README.md")
print(dir(data)) it returns ['CHECK_AFTER_INIT_FLAG', '_CompletableGithubObject__complete', '_CompletableGithubObject__completed', '_GithubObject__makeSimpleAttribute', '_GithubObject__makeSimpleListAttribute', '_GithubObject__makeTransformedAttribute', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_completeIfNeeded', '_completeIfNotSet', '_content', '_download_url', '_encoding', '_git_url', '_headers', '_html_url', '_initAttributes', '_license', '_makeBoolAttribute', '_makeClassAttribute', '_makeDatetimeAttribute', '_makeDictAttribute', '_makeDictOfStringsToClassesAttribute', '_makeFloatAttribute', '_makeIntAttribute', '_makeListOfClassesAttribute', '_makeListOfDictsAttribute', '_makeListOfIntsAttribute', '_makeListOfListOfStringsAttribute', '_makeListOfStringsAttribute', '_makeStringAttribute', '_makeTimestampAttribute', '_name', '_parentUrl', '_path', '_rawData', '_repository', '_requester', '_sha', '_size', '_storeAndUseAttributes', '_text_matches', '_type', '_url', '_useAttributes', 'content', 'decoded_content', 'download_url', 'encoding', 'etag', 'get__repr__', 'git_url', 'html_url', 'last_modified', 'license', 'name', 'path', 'raw_data', 'raw_headers', 'repository', 'setCheckAfterInitFlag', 'sha', 'size', 'text_matches', 'type', 'update', 'url'] a bit of eyes prying can gives us body = data.decoded_content
print(body) voila this renders the data in raw format. |
ContentFile.content
returns the base64-encoded content from the API. The API also supports getting the raw format of the file.Is there any way to do this via the library today? If not, would you be open to adding support for it?
The text was updated successfully, but these errors were encountered: