GitHub PullRequestReviewCommentEvent at 2014-03-15 01:17:38
Repository: requests-toolbelt
Actor: sigmavirus24
Payload: {"comment":{"url":"https://api.github.com/repos/sigmavirus24/requests-toolbelt/pulls/comments/10632580","id":10632580,"diff_hunk":"@@ -0,0 +1,145 @@\n+# -*- coding: utf-8 -*-\n+\"\"\"\n+\n+requests_toolbelt.multipart.decoder\n+===================================\n+\n+This holds all the implementation details of the MultipartDecoder\n+\n+\"\"\"\n+\n+from .encoder import encode_with\n+from requests.structures import CaseInsensitiveDict\n+\n+\n+def _split_on_find(content, bound):\n+    point = content.find(bound)\n+    return content[:point], content[point + len(bound):]\n+\n+\n+class ImproperBodyPartContentException(Exception):\n+    def __init__(self, *args):\n+        super(ImproperBodyPartContentException, self).__init__(*args)\n+\n+\n+class BodyPart(object):\n+    \"\"\"\n+\n+    The ``BodyPart`` object is a ``Response``-like interface to an individual\n+    subpart of a multipart response. It is expected that these will\n+    generally be created by objects of the ``MultipartDecoder`` class.\n+\n+    Like ``Response``, there is a ``CaseInsensitiveDict`` object named header,\n+    ``content`` to access bytes, ``text`` to access unicode, and ``encoding``\n+    to access the unicode codec.\n+\n+    \"\"\"\n+\n+    def __init__(self, content, encoding):\n+        headers = {}\n+        # Split into header section (if any) and the content\n+        if b'\\r\\n\\r\\n' in content:\n+            first, self.content = _split_on_find(content, b'\\r\\n\\r\\n')\n+            if first != b'':\n+                for line in first.split(b'\\r\\n'):\n+                    if b': ' in line:\n+                        h_key, h_value = _split_on_find(line, b': ')\n+                        headers[h_key] = h_value\n+        elif b'\\r\\n' == content[:2]:\n+            self.content = content[2:]","path":"requests_toolbelt/multipart/decoder.py","position":49,"original_position":49,"commit_id":"dd98e0d6de9a64fcba73edd0887199c7835b545f","original_commit_id":"dd98e0d6de9a64fcba73edd0887199c7835b545f","user":{"login":"sigmavirus24","id":240830,"avatar_url":"https://gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https%3A%2F%2Fidenticons.github.com%2F4a71764034cdae877484be72718ba526.png&r=x","gravatar_id":"c148356d89f925e692178bee1d93acf7","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"body":"Could you add a comment about what's happening here?","created_at":"2014-03-15T01:17:38Z","updated_at":"2014-03-15T01:17:38Z","html_url":"https://github.com/sigmavirus24/requests-toolbelt/pull/15#discussion_r10632580","pull_request_url":"https://api.github.com/repos/sigmavirus24/requests-toolbelt/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/sigmavirus24/requests-toolbelt/pulls/comments/10632580"},"html":{"href":"https://github.com/sigmavirus24/requests-toolbelt/pull/15#discussion_r10632580"},"pull_request":{"href":"https://api.github.com/repos/sigmavirus24/requests-toolbelt/pulls/15"}}}}