{"action":"closed","issue":{"url":"https://api.github.com/repos/box/box-python-sdk/issues/380","repository_url":"https://api.github.com/repos/box/box-python-sdk","labels_url":"https://api.github.com/repos/box/box-python-sdk/issues/380/labels{/name}","comments_url":"https://api.github.com/repos/box/box-python-sdk/issues/380/comments","events_url":"https://api.github.com/repos/box/box-python-sdk/issues/380/events","html_url":"https://github.com/box/box-python-sdk/issues/380","id":389780983,"node_id":"MDU6SXNzdWUzODk3ODA5ODM=","number":380,"title":"Upload Byte Stream","user":{"login":"davidkazuhiro","id":474054,"node_id":"MDQ6VXNlcjQ3NDA1NA==","avatar_url":"https://avatars1.githubusercontent.com/u/474054?v=4","gravatar_id":"","url":"https://api.github.com/users/davidkazuhiro","html_url":"https://github.com/davidkazuhiro","followers_url":"https://api.github.com/users/davidkazuhiro/followers","following_url":"https://api.github.com/users/davidkazuhiro/following{/other_user}","gists_url":"https://api.github.com/users/davidkazuhiro/gists{/gist_id}","starred_url":"https://api.github.com/users/davidkazuhiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidkazuhiro/subscriptions","organizations_url":"https://api.github.com/users/davidkazuhiro/orgs","repos_url":"https://api.github.com/users/davidkazuhiro/repos","events_url":"https://api.github.com/users/davidkazuhiro/events{/privacy}","received_events_url":"https://api.github.com/users/davidkazuhiro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"Jeff-Meadows","id":3839339,"node_id":"MDQ6VXNlcjM4MzkzMzk=","avatar_url":"https://avatars2.githubusercontent.com/u/3839339?v=4","gravatar_id":"","url":"https://api.github.com/users/Jeff-Meadows","html_url":"https://github.com/Jeff-Meadows","followers_url":"https://api.github.com/users/Jeff-Meadows/followers","following_url":"https://api.github.com/users/Jeff-Meadows/following{/other_user}","gists_url":"https://api.github.com/users/Jeff-Meadows/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeff-Meadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeff-Meadows/subscriptions","organizations_url":"https://api.github.com/users/Jeff-Meadows/orgs","repos_url":"https://api.github.com/users/Jeff-Meadows/repos","events_url":"https://api.github.com/users/Jeff-Meadows/events{/privacy}","received_events_url":"https://api.github.com/users/Jeff-Meadows/received_events","type":"User","site_admin":false},"assignees":[{"login":"Jeff-Meadows","id":3839339,"node_id":"MDQ6VXNlcjM4MzkzMzk=","avatar_url":"https://avatars2.githubusercontent.com/u/3839339?v=4","gravatar_id":"","url":"https://api.github.com/users/Jeff-Meadows","html_url":"https://github.com/Jeff-Meadows","followers_url":"https://api.github.com/users/Jeff-Meadows/followers","following_url":"https://api.github.com/users/Jeff-Meadows/following{/other_user}","gists_url":"https://api.github.com/users/Jeff-Meadows/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeff-Meadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeff-Meadows/subscriptions","organizations_url":"https://api.github.com/users/Jeff-Meadows/orgs","repos_url":"https://api.github.com/users/Jeff-Meadows/repos","events_url":"https://api.github.com/users/Jeff-Meadows/events{/privacy}","received_events_url":"https://api.github.com/users/Jeff-Meadows/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-12-11T14:07:03Z","updated_at":"2018-12-11T16:31:20Z","closed_at":"2018-12-11T16:31:20Z","author_association":"NONE","body":"- [x] I have checked that the [SDK documentation][sdk-docs] and [API documentation][api-docs] doesn't solve my issue\r\n\r\n### Description of the Issue\r\nI'm using pandas to generate an excel file.\r\nThe output is a `io.BytesIO()` stream in memory.\r\nI want to upload it directly to Box but the Python SDK only supports file paths or `io.StringIO()` streams.\r\n\r\nIf I pass a `io.BytesIO()` I get the error `AttributeError: 'bytes' object has no attribute 'tell'`\r\n\r\nCan it be made possible to upload byte streams?\r\n(If it is possible, I didn't see it in the docs, so maybe an example could be included?)\r\n\r\n### Versions Used\r\nBox Python SDK: 2.0.0\r\nPython: 3.7.1\r\n\r\n### Steps to Reproduce\r\n\r\n1. Install Dependencies\r\n\r\n```\r\npip install boxsdk==2.0.0 pandas==0.23.4 openpyxl==2.5.12\r\n```\r\n\r\n2. Run python script\r\n```\r\nimport io\r\n\r\nfrom boxsdk import Client, OAuth2\r\nimport pandas\r\n\r\noutput = io.BytesIO()\r\nwriter = pandas.ExcelWriter(output, engine='openpyxl')\r\npandas.Series().to_excel(writer, sheet_name='Sheet1', header=True)\r\nwriter.save()\r\noauth2 = OAuth2(CLIENT, KEY, access_token=TOKEN)\r\nclient = Client(oauth2)\r\nbox_file = client.folder('0').upload_stream(output.getvalue(), 'test.xlsx')\r\n```\r\n\r\n### Error Message, Including Traceback\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/util/api_call_decorator.py\", line 71, in call\r\n    return method(*args, **kwargs)\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/object/folder.py\", line 285, in upload_stream\r\n    file_response = self._session.post(url, data=data, files=files, expect_json_response=False).json()\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/session/session.py\", line 97, in post\r\n    return self.request('POST', url, **kwargs)\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/session/session.py\", line 143, in request\r\n    response = self._prepare_and_send_request(method, url, **kwargs)\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/session/session.py\", line 347, in _prepare_and_send_request\r\n    kwargs['file_stream_positions'] = dict((name, file_tuple[1].tell()) for name, file_tuple in files.items())\r\n  File \"/usr/local/lib/python3.7/site-packages/boxsdk/session/session.py\", line 347, in <genexpr>\r\n    kwargs['file_stream_positions'] = dict((name, file_tuple[1].tell()) for name, file_tuple in files.items())\r\nAttributeError: 'bytes' object has no attribute 'tell'\r\n```"}}
{"actor":{"display_login":"Jeff-Meadows"}}