Title: Large plain/text files returned as gzip and library doesn't handle this case · Issue #19 · smartfile/client-python · GitHub
Open Graph Title: Large plain/text files returned as gzip and library doesn't handle this case · Issue #19 · smartfile/client-python
X Title: Large plain/text files returned as gzip and library doesn't handle this case · Issue #19 · smartfile/client-python
Description: python --version Python 3.6.1 smartfile==2.19 Example from documentation: >>> import shutil >>> from smartfile import BasicClient >>> api = BasicClient() >>> f = api.get('/path/data/', 'small.txt') >>> with open('small.txt', 'wb') as o: ...
Open Graph Description: python --version Python 3.6.1 smartfile==2.19 Example from documentation: >>> import shutil >>> from smartfile import BasicClient >>> api = BasicClient() >>> f = api.get('/path/data/', 'small.txt')...
X Description: python --version Python 3.6.1 smartfile==2.19 Example from documentation: >>> import shutil >>> from smartfile import BasicClient >>> api = BasicClient() >>> f =...
Opengraph URL: https://github.com/smartfile/client-python/issues/19
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Large plain/text files returned as gzip and library doesn't handle this case","articleBody":"python --version\r\n**Python 3.6.1**\r\n\r\n**smartfile==2.19**\r\n\r\nExample from documentation:\r\n\r\n```\r\n\u003e\u003e\u003e import shutil\r\n\u003e\u003e\u003e from smartfile import BasicClient\r\n\u003e\u003e\u003e api = BasicClient()\r\n\u003e\u003e\u003e f = api.get('/path/data/', 'small.txt')\r\n\u003e\u003e\u003e with open('small.txt', 'wb') as o:\r\n\u003e\u003e\u003e # f.getheaders().get('Content-Encoding') \r\n\u003e\u003e\u003e shutil.copyfileobj(f, o)\r\n```\r\nworks fine with small files, but when file is large (I tested 100Mb text file) \r\n`f.getheaders().get('Content-Encoding')` returns `gzip` and instead of expected source text file gzip content is downloaded and saved to file. \r\n\r\nIt can be handled with:\r\n```\r\n if f.getheaders().get('Content-Encoding') == 'gzip':\r\n o.write(gzip.decompress(f.read()))\r\n else:\r\n shutil.copyfileobj(f, o)\r\n```\r\nbut ideally I think library should handle this case.\r\nOr, at least, docs have to be updated and mention this possible issue.","author":{"url":"https://github.com/grunichev","@type":"Person","name":"grunichev"},"datePublished":"2017-10-10T11:29:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/19/client-python/issues/19"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f6ec9e55-8de6-8234-01b7-f6f730a3551d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9870:31543F:54C6AD:76FD15:69821961 |
| html-safe-nonce | 7f8e3249d9b85be6681bc6281fe27c6b71ad1778c7d78b94781638448ebd65fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODcwOjMxNTQzRjo1NEM2QUQ6NzZGRDE1OjY5ODIxOTYxIiwidmlzaXRvcl9pZCI6IjU2NDM2ODU3ODI4OTcxNzA3ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0374cbb44fb61291597f2cccdf864001a3f4a11afa7045967596cd3a48694813 |
| hovercard-subject-tag | issue:264193144 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/smartfile/client-python/19/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a8b3ffcd685be4218a630e385899cb84653d5af0fa2622ce780d43237d1f6091/smartfile/client-python/issues/19 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a8b3ffcd685be4218a630e385899cb84653d5af0fa2622ce780d43237d1f6091/smartfile/client-python/issues/19 |
| og:image:alt | python --version Python 3.6.1 smartfile==2.19 Example from documentation: >>> import shutil >>> from smartfile import BasicClient >>> api = BasicClient() >>> f = api.get('/path/data/', 'small.txt')... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | grunichev |
| hostname | github.com |
| expected-hostname | github.com |
| None | c5d01132ac10b0b45b88f4c1c8790502d669eb065ff383dc5e4757c174f3380f |
| turbo-cache-control | no-preview |
| go-import | github.com/smartfile/client-python git https://github.com/smartfile/client-python.git |
| octolytics-dimension-user_id | 2232208 |
| octolytics-dimension-user_login | smartfile |
| octolytics-dimension-repository_id | 3063735 |
| octolytics-dimension-repository_nwo | smartfile/client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3063735 |
| octolytics-dimension-repository_network_root_nwo | smartfile/client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ac87bbde7c9f04b7ead5505c12f56048d89df09 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width