{"action":"created","issue":{"url":"https://api.github.com/repos/crits/crits_services/issues/135","labels_url":"https://api.github.com/repos/crits/crits_services/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/crits/crits_services/issues/135/comments","events_url":"https://api.github.com/repos/crits/crits_services/issues/135/events","html_url":"https://github.com/crits/crits_services/pull/135","id":99103086,"number":135,"title":"Replace StringIO with BytesIO - verification pending","user":{"login":"frbapolkosnik","id":4399806,"avatar_url":"https://avatars.githubusercontent.com/u/4399806?v=3","gravatar_id":"","url":"https://api.github.com/users/frbapolkosnik","html_url":"https://github.com/frbapolkosnik","followers_url":"https://api.github.com/users/frbapolkosnik/followers","following_url":"https://api.github.com/users/frbapolkosnik/following{/other_user}","gists_url":"https://api.github.com/users/frbapolkosnik/gists{/gist_id}","starred_url":"https://api.github.com/users/frbapolkosnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frbapolkosnik/subscriptions","organizations_url":"https://api.github.com/users/frbapolkosnik/orgs","repos_url":"https://api.github.com/users/frbapolkosnik/repos","events_url":"https://api.github.com/users/frbapolkosnik/events{/privacy}","received_events_url":"https://api.github.com/users/frbapolkosnik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-05T02:41:28Z","updated_at":"2015-08-07T05:56:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/crits/crits_services/pulls/135","html_url":"https://github.com/crits/crits_services/pull/135","diff_url":"https://github.com/crits/crits_services/pull/135.diff","patch_url":"https://github.com/crits/crits_services/pull/135.patch"},"body":"Replace StringIO with BytesIO for more portable code."},"comment":{"url":"https://api.github.com/repos/crits/crits_services/issues/comments/128606881","html_url":"https://github.com/crits/crits_services/pull/135#issuecomment-128606881","issue_url":"https://api.github.com/repos/crits/crits_services/issues/135","id":128606881,"user":{"login":"frbapolkosnik","id":4399806,"avatar_url":"https://avatars.githubusercontent.com/u/4399806?v=3","gravatar_id":"","url":"https://api.github.com/users/frbapolkosnik","html_url":"https://github.com/frbapolkosnik","followers_url":"https://api.github.com/users/frbapolkosnik/followers","following_url":"https://api.github.com/users/frbapolkosnik/following{/other_user}","gists_url":"https://api.github.com/users/frbapolkosnik/gists{/gist_id}","starred_url":"https://api.github.com/users/frbapolkosnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frbapolkosnik/subscriptions","organizations_url":"https://api.github.com/users/frbapolkosnik/orgs","repos_url":"https://api.github.com/users/frbapolkosnik/repos","events_url":"https://api.github.com/users/frbapolkosnik/events{/privacy}","received_events_url":"https://api.github.com/users/frbapolkosnik/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T05:56:17Z","updated_at":"2015-08-07T05:56:17Z","body":"# 4 simple tests for BytesIO and StringIO...\r\nimport io\r\nxml = u'test'\r\nxml2 = 'test2'\r\nxml2 = xml2.encode('utf-8').strip()\r\n# test with unicode\r\nf = io.StringIO(xml)\r\nprint f\r\n# test with a string\r\ng = io.BytesIO(xml2)\r\nprint g\r\n# test with unicode\r\ntry:\r\n    g = io.BytesIO(xml)\r\n    print g\r\nexcept Exception as e:\r\n    print e\r\n# test with a string\r\ntry:\r\n    f = io.StringIO(xml2)\r\n    print f\r\nexcept Exception as e:\r\n    print e\r\n\r\n$ python main.py                                                                                                           \r\n<_io.StringIO object at 0x7f8d041085d0>                                                                                          \r\n<_io.BytesIO object at 0x7f8d04170bf0>                                                                                           \r\n'unicode' does not have the buffer interface                                                                                     \r\ninitial_value must be unicode or None, not str \r\n\r\nSo, it looks like we can use io.BytesIO unless we deal with unicode."}}