{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/comments/33766170","id":33766170,"diff_hunk":"@@ -1,6 +1,220 @@\n Kinto python client\n ###################\n \n-Python library to interact with a `Kinto <https://kinto.readthedocs.org>`_\n-HTTP server.\n+Kinto is a service allowing you to store and synchronize arbitrary data,\n+attached to an user account. It's primary interface is HTTP.\n+\n+`kinto-client` is a python library which aims to ease the interaction with\n+kinto for clients. `A project with related goals is\n+also available for JavaScript <https://github.com/mozilla-services/cliquetis>`_.\n+\n+.. warning::\n+\n+    Everything described here is still pure fiction and no implementation\n+    of this is ready to be used yet.\n+\n+\n+Usage\n+=====\n+\n+.. note::\n+\n+    The approach this library takes is different from the one described in the\n+    `Cliquetis <https://github.com/mozilla-services/cliquetis>`_ javascript\n+    client: Operations are always performed directly on the server, and no\n+    synchronisation features are implemented yet.\n+\n+- The first version of this API doesn't cache any access nor provide any\n+  refresh mechanism. If you want to be sure you have the last data available,\n+  issue another call.\n+\n+Here are is an overview of what the API looks like:\n+\n+.. code-block:: python\n+\n+    from kintoclient import Bucket\n+\n+    bucket = Bucket('personal', server_url='http://localhost:8888/v1',\n+                    auth=('alexis', 'p4ssw0rd'))\n+    todo = bucket.get_collection('todo', create=True)\n+\n+    records = collection.get_records()\n+    for i, record in enumerate(records):\n+        record.data.title = 'Todo #%d' %i\n+\n+    todo.save_records(records)\n+\n+\n+Handling buckets\n+================\n+\n+All operations are rooted in a bucket. It makes little sense for\n+one application to handle multiple buckets at once.\n+\n+The passed `auth` parameter is a `requests <docs.python-requests.org>`_\n+authentication policy, allowing you to authenticate with whatever means\n+fits you.\n+\n+By default, Kinto supports Firefox Accounts and Basic authentication policies.\n+\n+.. code-block:: python\n+\n+    bucket = Bucket('payments', server_url='http://localhost:8888/v1',\n+                    auth=credentials)\n+\n+    # Passing `create=True` to the bucket will make an HTTP request to\n+    # create it.\n+    bucket = Bucket('payments', server_url='http://localhost:8888/v1',\n+                    auth=credential, create=True)\n+\n+\n+Collections\n+===========\n+\n+A collection is where records are stored.\n+\n+.. code-block:: python\n+\n+    # Once the bucket handy, use it to handle collections or groups.\n+    collection = bucket.create_collection('receipts')\n+\n+    # Or get an existing one.\n+    collection = bucket.get_collection('receipts')\n+\n+    # To delete an existing collection.\n+    bucket.delete_collection('receipts')\n+\n+\n+Records\n+=======\n+\n+Records can be retrieved from and saved to buckets.\n+\n+.. code-block:: python\n+\n+    # Create an empty record\n+    record = collection.create_record()\n+\n+    # You can also pass a python dictionary to represent the record\n+    record = collection.create_record(dict(id='XXX', status='done',\n+                                           title='Todo #1'))\n+\n+    # Get all records\n+    record = collection.get_all_records()\n+    record = collection.get_record(id='89881454-e4e9-4ef0-99a9-404d95900352')\n+    collection.save_record(record)\n+    collection.save_records([record1, record2])\n+    collection.delete_record(id='89881454-e4e9-4ef0-99a9-404d95900352')\n+    collection.delete_records([record1, record2])\n+\n+\n+Handling conflicts\n+------------------\n+\n+XXX\n+\n+Permissions\n+===========\n+\n+ By default, the authenticated user will get read and write access to the\n+ manipulated objects. It is possible to change this behavior by passing a dict\n+ to the `permissions` parameter.\n+\n+ .. code-block:: python\n+\n+    record = collection.create_record(\n+        data={},\n+        permissions={'read': ['group:groupid']})\n+\n+.. note::\n+\n+    Every creation or modification operation on a distant object can be given\n+    a `permissions` parameter.\n+\n+The `Bucket`, `Collection`, `Group` and `Record` class have a special\n+`permissions` object that can be mutated in order to update the permissions\n+model attached to the object.\n+\n+.. code-block:: python\n+\n+    bucket = Bucket('personal', auth=('alexis', 'p4ssw0rd'))\n+\n+    # XXX We need to find a way to get other's names from kinto, this isn't\n+    # realistic.\n+    friends = ['natim', 'niko', 'mat', 'tarek']\n+    bucket.permissions.write += friends\n+    bucket.permissions.create_collection += friends","path":"README.rst","position":148,"original_position":148,"commit_id":"7bb7cb6e88a9f1b3aec10d6398a626c0bcdb6477","original_commit_id":"7bb7cb6e88a9f1b3aec10d6398a626c0bcdb6477","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"body":"I find it more pythonic this way and it's trivial to implement.","created_at":"2015-07-02T10:43:28Z","updated_at":"2015-07-02T10:43:28Z","html_url":"https://github.com/mozilla-services/kinto-client/pull/1#discussion_r33766170","pull_request_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/comments/33766170"},"html":{"href":"https://github.com/mozilla-services/kinto-client/pull/1#discussion_r33766170"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1","id":37996254,"html_url":"https://github.com/mozilla-services/kinto-client/pull/1","diff_url":"https://github.com/mozilla-services/kinto-client/pull/1.diff","patch_url":"https://github.com/mozilla-services/kinto-client/pull/1.patch","issue_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/1","number":1,"state":"open","locked":false,"title":"Add dreamcode in the readme","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-18T11:25:21Z","updated_at":"2015-07-02T10:43:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fda199190b70799ce4ff3674f721c5747071621","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/1/comments","statuses_url":"https://api.github.com/repos/mozilla-services/kinto-client/statuses/7bb7cb6e88a9f1b3aec10d6398a626c0bcdb6477","head":{"label":"mozilla-services:readme","ref":"readme","sha":"7bb7cb6e88a9f1b3aec10d6398a626c0bcdb6477","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":37655419,"name":"kinto-client","full_name":"mozilla-services/kinto-client","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/kinto-client","description":"Python library to interact with Kinto","fork":false,"url":"https://api.github.com/repos/mozilla-services/kinto-client","forks_url":"https://api.github.com/repos/mozilla-services/kinto-client/forks","keys_url":"https://api.github.com/repos/mozilla-services/kinto-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/kinto-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/kinto-client/teams","hooks_url":"https://api.github.com/repos/mozilla-services/kinto-client/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/kinto-client/events","assignees_url":"https://api.github.com/repos/mozilla-services/kinto-client/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/kinto-client/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/kinto-client/tags","blobs_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/kinto-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/kinto-client/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/kinto-client/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/kinto-client/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/kinto-client/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/kinto-client/subscription","commits_url":"https://api.github.com/repos/mozilla-services/kinto-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/kinto-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-services/kinto-client/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/kinto-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/kinto-client/merges","archive_url":"https://api.github.com/repos/mozilla-services/kinto-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/kinto-client/downloads","issues_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/kinto-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/kinto-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/kinto-client/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/kinto-client/releases{/id}","created_at":"2015-06-18T11:24:34Z","updated_at":"2015-07-01T16:14:53Z","pushed_at":"2015-07-02T08:14:27Z","git_url":"git://github.com/mozilla-services/kinto-client.git","ssh_url":"git@github.com:mozilla-services/kinto-client.git","clone_url":"https://github.com/mozilla-services/kinto-client.git","svn_url":"https://github.com/mozilla-services/kinto-client","homepage":null,"size":144,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-services:master","ref":"master","sha":"700e9c8fd8880fb1f4b80c5381e0bccea5fabea9","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":37655419,"name":"kinto-client","full_name":"mozilla-services/kinto-client","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/kinto-client","description":"Python library to interact with Kinto","fork":false,"url":"https://api.github.com/repos/mozilla-services/kinto-client","forks_url":"https://api.github.com/repos/mozilla-services/kinto-client/forks","keys_url":"https://api.github.com/repos/mozilla-services/kinto-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/kinto-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/kinto-client/teams","hooks_url":"https://api.github.com/repos/mozilla-services/kinto-client/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/kinto-client/events","assignees_url":"https://api.github.com/repos/mozilla-services/kinto-client/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/kinto-client/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/kinto-client/tags","blobs_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/kinto-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/kinto-client/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/kinto-client/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/kinto-client/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/kinto-client/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/kinto-client/subscription","commits_url":"https://api.github.com/repos/mozilla-services/kinto-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/kinto-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/kinto-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-services/kinto-client/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/kinto-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/kinto-client/merges","archive_url":"https://api.github.com/repos/mozilla-services/kinto-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/kinto-client/downloads","issues_url":"https://api.github.com/repos/mozilla-services/kinto-client/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/kinto-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/kinto-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/kinto-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/kinto-client/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/kinto-client/releases{/id}","created_at":"2015-06-18T11:24:34Z","updated_at":"2015-07-01T16:14:53Z","pushed_at":"2015-07-02T08:14:27Z","git_url":"git://github.com/mozilla-services/kinto-client.git","ssh_url":"git@github.com:mozilla-services/kinto-client.git","clone_url":"https://github.com/mozilla-services/kinto-client.git","svn_url":"https://github.com/mozilla-services/kinto-client","homepage":null,"size":144,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1"},"html":{"href":"https://github.com/mozilla-services/kinto-client/pull/1"},"issue":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/issues/1"},"comments":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/kinto-client/statuses/7bb7cb6e88a9f1b3aec10d6398a626c0bcdb6477"}}}}