{ "info": { "author": "LOGILAB S.A. (Paris, FRANCE)", "author_email": "contact@logilab.fr", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: CubicWeb", "Programming Language :: Python" ], "description": ".. -*- coding: utf-8 -*-\n\n=============\n CwClientLib\n=============\n\nSummary\n-------\n\nA Python library to easily build CubicWeb_ clients:\n\n* execute RQL_ queries remotely (using rqlcontroller_),\n* access instances that requires authentication (using signedrequest_).\n\nIt also provides a simple command line tool (cwrql) to execute simple requests.\n\nRequirements\n------------\n\nclient side:\n\n- requests_ (>= 2.0)\n\nserver side:\n\n- CubicWeb (>= 3.18.3) with the cubes rqlcontroller_ and signedrequest_\n\n\nConfiguration\n-------------\n\n``cwclientlib`` implements a ``cwproxy_for(instance)`` function that\nwill build a ``CWProxy`` for the given instance, reading\nauthentication credentials from a configuration file (can be a ini\nfile, json or yaml). The default configuration file name is\n`~/.config/cwclientlibrc` (using the ini file format), but this can be\nchanged using the ``CWCLCONF`` environment variable. For example:\n\n.. code-block:: bash\n\n david@perseus:~$ cat ~/.config/cwclientlibrc\n [cwo]\n url = https://www.cubicweb.org/\n token-id = my_cwo_token\n secret = \n\n [elo]\n url = https://www.logilab.org\n token-id = my_elo_token\n secret = \n\n [activites]\n url = https://my.intranet/activites\n auth-mech = kerberos\n\nmakes it possible to write:\n\n.. code-block:: bash\n\n david@perseus:~$ cwrql cwo \"Any N,S WHERE P eid 1251664, P name N, P summary S\"\n projman a project management tool\n\n david@perseus:~$ cwrql -v ejsonexport -j cwo \"Any P WHERE P eid 1251664\"\n [{\"description\": \"It reads project descriptions [...]\",\n \"modification_date\": \"2015/02/13 18:12:40\",\n \"icon_format\": null,\n \"description_format\": \"text/rest\",\n \"summary\": \"a project management tool\",\n \"downloadurl\": \"http://download.logilab.org/pub/projman\",\n \"cwuri\": \"http://www.logilab.org/873\",\n \"__cwetype__\": \"Project\",\n \"eid\": 1251664,\n \"creation_date\": \"2006/09/28 17:44:38\",\n \"homepage\": null,\n \"debian_source_package\": null,\n \"name\": \"projman\"}]\n\nor:\n\n.. code-block:: python\n\n from cwclientlib import cwproxy_for\n\n client = cwproxy_for('cwo')\n # or client = cwproxy_for('https://www.cubicweb.org/')\n query = 'Any X WHERE X is Ticket, X concerns P, P name \"cwclientlib\"'\n resp = client.rql(query)\n data = resp.json()\n\nNote that the config file may contain credentials, so its permissions\nmust be readable only by the user (checked on posix platforms only).\n\n\nUsing signed requests\n---------------------\n\nOnce the cube signedrequest_ is added, in the WebUI:\n\n#. View a ``CWUser`` and click the action ``add an AuthToken``\n#. Give an identifier to the token and make it enabled\n#. Use the token identifier and the token in your source code\n\nUsing Kerberos\n--------------\n\nJust make sure `Python-Kerberos`_ and `Requests-Kerberos`_ are\ninstalled. The cubicweb server must, indeed, support kerberos-based\nauthentication.\n\n\nConfiguration\n-------------\n\nYou can define url and credentials for commonly used cubicweb\nendpoints in a config file. By default, on Linux, it will be a ini\nfile located at ``$HOME/.config/cwclientlibrc`` but you may define the\n``CWCLCONF`` environmentvariable to specify it. This config file can\nalso be a YAML (file name must end with .yaml) or a JSON file (.json).\n\nThe file will look like:\n\n.. code-block:: ini\n\n [cwo]\n url = https://www.cubicweb.org/\n token-id = my token id\n secret = \n\n [intra]\n url = https://my.intranet\n auth-mech = kerberos\n server-ca = /path/to/ca-bundle.pem\n\n\nCommand line tools\n------------------\n\ncwclientlib comes with 3 simple command-line tools allowing to easily\nrequest a cubicweb application from a shell:\n\n`cwrql` to make RQL queries:\n\n.. code-block:: bash\n\n david@perseus:~$ cwrql -h\n Usage: cwrql [options] (url|instance_id) rqlquery [rqlquery2] ...\n\n Options:\n -h, --help show this help message and exit\n -j, --json produce JSON data\n -v VID, --vid=VID vid to use (default is jsonexport)\n -S, --no-ssl do NOT verify ssl server certificate; ignored if --ca is\n given\n -c CA, --ca=CA Bundle CA to use to verify server certificate\n -w, --rqlio use rqlio\n david@perseus:~$ cwrql cwo \"Any VN, VS WHERE V version_of P,\n > P name 'cwclientlib', V num VN, V in_state S, S name VS\"\n 0.2.1 published\n 0.3.0 dev\n 0.2.0 published\n 0.1.0 published\n\n`cwget` to make any king of GET request (ie. call a specific cubicweb controller):\n\n.. code-block:: bash\n\n david@perseus:~$ cwget cwo /testconfig/1251730 \\\n vid=apycot.get_configuration environment=4209277\n [{\"pylint_threshold\": \"7\", \"install\": \"python_setup\", \"pycoverage_threshold\": \"70\"}]\n\n`cwshell` to connect to a cubicweb endopint and start an interactive\npython shell with a few additional builtins ``rql`` and\n``client``. This shell also provides RQL auto-completion:\n\n.. code-block:: bash\n\n david@perseus:~$ cwshell cwo\n You are connected to https://www.cubicweb.org\n >>> client.execute('Any X WHERE X is P\n Patch Plan Project ProjectEnvironment\n >>> rql('Any P, N WHERE X is Project, X name P ,V version_of X, V in_state S, V num N, S name \"ready\"')\n [[u'cubicweb-pyramid', u'0.2.0'], [u'cubicweb-simplefacet', u'0.3.2']]\n >>>\n\nAvailable extra builtins:\n\n:client: is the CWProxy instance connected to the cubicweb endpoint.\n\n:rql: shortcut for ``client.execute()``.\n\n\n\nPython examples\n---------------\n\nSimple read only query:\n\n.. code-block:: python\n\n from cwclientlib import cwproxy\n\n client = cwproxy.CWProxy('http://www.cubicweb.org/')\n query = 'Any X WHERE X is Ticket, X concerns P, P name \"cwclientlib\"'\n resp = client.rql(query)\n data = resp.json()\n\nCreating an entity, authenticating with signedrequest_ with\ncredentials read from the config file:\n\n.. code-block:: python\n\n from cwclientlib import cwproxy_for\n\n client = cwproxy_for('cwo')\n queries = [('INSERT CWUser U: U login %(l)s, U upassword %(p)s',\n {'l': 'Babar', 'p': 'cubicweb rulez & 42'}), ]\n resp = client.rqlio(queries)\n data = resp.json()\n\nCreating an entity, authenticating with signedrequest_ building the\nauthentifier by hand:\n\n.. code-block:: python\n\n from cwclientlib import cwproxy\n\n auth = cwproxy.SignedRequestAuth('my token', '6ed44d82172211e49d9777269ec78bae')\n client = cwproxy.CWProxy('https://www.cubicweb.org/', auth)\n queries = [('INSERT CWUser U: U login %(l)s, U upassword %(p)s',\n {'l': 'Babar', 'p': 'cubicweb rulez & 42'}), ]\n resp = client.rqlio(queries)\n data = resp.json()\n\nCreating a file entity, authenticating with signedrequest_:\n\n.. code-block:: python\n\n from io import BytesIO\n from cwclientlib import cwproxy_for\n\n client = cwproxy_for('cwo')\n queries = [('INSERT File F: F data %(content)s, F data_name %(fname)s',\n {'content': BytesIO('some binary data'), 'fname': 'toto.bin'})]\n resp = client.rqlio(queries)\n data = resp.json()\n\n\nUsing ``builders`` helpers, authenticating explicitely with the\nkerberos authentifier:\n\n.. code-block:: python\n\n from cwclientlib import cwproxy, builders\n from requests_kerberos import HTTPKerberosAuth, OPTIONAL\n\n auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)\n client = cwproxy.CWProxy('https://www.cubicweb.org/', auth)\n queries = [builders.create_entity('CWUser', login='Babar', upassword='secret'),\n ('SET U in_group G WHERE U eid %(eid)s, G name \"users\"', {'eid': '__r0'}),\n\t ]\n resp = client.rqlio(queries)\n data = resp.json()\n\n.. _CubicWeb: http://www.cubicweb.org/\n.. _RQL: http://docs.cubicweb.org/annexes/rql/language\n.. _rqlcontroller: http://www.cubicweb.org/project/cubicweb-rqlcontroller/\n.. _signedrequest: http://www.cubicweb.org/project/cubicweb-signedrequest/\n.. _requests: http://docs.python-requests.org/en/latest/\n.. _`Python-Kerberos`: https://pypi.python.org/pypi/kerberos\n.. _`Requests-Kerberos`: https://github.com/requests/requests-kerberos.git", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.cubicweb.org/project/cwclientlib", "keywords": "", "license": "LGPL", "maintainer": "", "maintainer_email": "", "name": "cwclientlib", "package_url": "https://pypi.org/project/cwclientlib/", "platform": "", "project_url": "https://pypi.org/project/cwclientlib/", "project_urls": { "Homepage": "http://www.cubicweb.org/project/cwclientlib" }, "release_url": "https://pypi.org/project/cwclientlib/0.6.0/", "requires_dist": null, "requires_python": "", "summary": "A Python library to easily build CubicWeb clients", "version": "0.6.0" }, "last_serial": 3954078, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2dcc2534381bc58ebeb5f93687a48497", "sha256": "4e76e6fd30798c824fc7df9d4836c2bb16c374524a5f6850318c1fe8d6bf5c77" }, "downloads": -1, "filename": "cwclientlib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2dcc2534381bc58ebeb5f93687a48497", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14698, "upload_time": "2014-07-31T12:38:16", "url": "https://files.pythonhosted.org/packages/65/ac/76f3d955763bad5c7525ba0a88debf9d57dad28a170b35c9895c6782fe8c/cwclientlib-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ef970182f1e00c5d2efc058396279c9a", "sha256": "f01b835f0a8106fea7ab49717565a476c247e069597b0c613cad7ff4b191542c" }, "downloads": -1, "filename": "cwclientlib-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ef970182f1e00c5d2efc058396279c9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15516, "upload_time": "2014-10-29T21:56:12", "url": "https://files.pythonhosted.org/packages/48/59/fece5597dfa13c14d8326e38d57fc6fa3b2a9b63c4ce0d777d8f37b565af/cwclientlib-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "fadb25d976e42acb1e25cde64a281577", "sha256": "942bfaafe0da3329c94fe84bd835439fdd87f8b7932c07a6af02f4d3b458ed27" }, "downloads": -1, "filename": "cwclientlib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "fadb25d976e42acb1e25cde64a281577", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15653, "upload_time": "2014-11-10T17:22:11", "url": "https://files.pythonhosted.org/packages/ae/f0/7342ff3e6fee75c50167a17d407ac73e047924fddf2c84e569dd82005d1d/cwclientlib-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "e3ed764ca60b50768d615ca9512e8b9c", "sha256": "1578ee5defc04c9204317c7409c78ab0fdf35ba990d42cc9e8ebf347c2f96a10" }, "downloads": -1, "filename": "cwclientlib-0.3.0.tar.gz", "has_sig": false, "md5_digest": "e3ed764ca60b50768d615ca9512e8b9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28971, "upload_time": "2015-06-14T17:13:49", "url": "https://files.pythonhosted.org/packages/91/92/4ac23fbf87f508f6b31c0b08c3dda68696fd0b78c9b47a3c2dc02b043136/cwclientlib-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "fc61cee1d1743b8a97f320a4de40e41d", "sha256": "fd36c9477663e15b65993a564c9d23035c28bbbc8b34a0507d307a3b7780ab08" }, "downloads": -1, "filename": "cwclientlib-0.3.1.tar.gz", "has_sig": false, "md5_digest": "fc61cee1d1743b8a97f320a4de40e41d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29242, "upload_time": "2015-06-17T23:41:54", "url": "https://files.pythonhosted.org/packages/66/91/cf2f4c3c08d27bfdba5c61a762a5a00c0df6725127b70cff4a0f68aebd3c/cwclientlib-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "4423d53f58c6f10c8cfaa200fe860ab7", "sha256": "4c8e26b2a6e9ac65b76a3cc71a31d1dc01b55c95fad683c85e10b5056fae7f49" }, "downloads": -1, "filename": "cwclientlib-0.4.0.tar.gz", "has_sig": false, "md5_digest": "4423d53f58c6f10c8cfaa200fe860ab7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29568, "upload_time": "2015-07-08T13:21:44", "url": "https://files.pythonhosted.org/packages/49/11/878c4fd0f068373dc69815adbdf0ff0230696c067f39b50dcba6700fe77a/cwclientlib-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "3ba19d270302f2a4c53328e5e63b7928", "sha256": "820416cb3891304db70693bb716d44bee098e7eead49570245f953af575cb6df" }, "downloads": -1, "filename": "cwclientlib-0.4.1.tar.gz", "has_sig": false, "md5_digest": "3ba19d270302f2a4c53328e5e63b7928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29563, "upload_time": "2015-07-27T15:56:12", "url": "https://files.pythonhosted.org/packages/68/2a/92a7f1bb5c03deda196400ded39625ffd15119200b4ab981d14be9112a7f/cwclientlib-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "844718bf97071e8fe677c330a4aa68e5", "sha256": "ff1d1dab82150cc25cd2261bbba5e952c57da02fc553b8f1e3da6b3db78d6d37" }, "downloads": -1, "filename": "cwclientlib-0.4.2.tar.gz", "has_sig": false, "md5_digest": "844718bf97071e8fe677c330a4aa68e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29731, "upload_time": "2016-10-03T08:11:08", "url": "https://files.pythonhosted.org/packages/e2/ba/2bc28bea05f170a0e0563872fff884a880ad5e7e44768045e8c9e9106966/cwclientlib-0.4.2.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "b9709e624ef2201624899379b6ba380f", "sha256": "7406ff446fdb2b780bb7c445ce474f1df3f66adb63d8008fbddc5451b298ef37" }, "downloads": -1, "filename": "cwclientlib-0.5.0.tar.gz", "has_sig": false, "md5_digest": "b9709e624ef2201624899379b6ba380f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30030, "upload_time": "2016-10-28T10:42:01", "url": "https://files.pythonhosted.org/packages/4b/18/2a67d087947d45a38fcfad915bcf57f0e00583cf69c269288d135eca876a/cwclientlib-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "583c4617f072c3114f673abaa508a5bb", "sha256": "0cab6dcf4830420a15138cef745a9020f21632490d43236245c32294bf8fbd21" }, "downloads": -1, "filename": "cwclientlib-0.5.1.tar.gz", "has_sig": false, "md5_digest": "583c4617f072c3114f673abaa508a5bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30050, "upload_time": "2017-01-06T22:48:56", "url": "https://files.pythonhosted.org/packages/ca/b4/b4869cbdc54b2e1bc179ad6fbb749986331a81b696060afdb630239e838c/cwclientlib-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "11e091d69ece8502fa213b676e90f8b5", "sha256": "686c8e389d40240b185fec4c3b82cf2c52ace90fe1c81ad6ca35da04465ad971" }, "downloads": -1, "filename": "cwclientlib-0.5.2.tar.gz", "has_sig": false, "md5_digest": "11e091d69ece8502fa213b676e90f8b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30102, "upload_time": "2017-01-13T17:06:47", "url": "https://files.pythonhosted.org/packages/12/51/300eb38a47159a6bf7c90b8728f92177d47eb70ef508725353a930abdc9e/cwclientlib-0.5.2.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "5ed726a44d19b5299bbc7513ce749fcc", "sha256": "72b315702c5ceb765f167c79b4d018f802cd17d5c297c7ff5330c9e30d7f4932" }, "downloads": -1, "filename": "cwclientlib-0.6.0.tar.gz", "has_sig": false, "md5_digest": "5ed726a44d19b5299bbc7513ce749fcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33584, "upload_time": "2018-06-12T14:32:58", "url": "https://files.pythonhosted.org/packages/95/55/bf0e9be778be0ba721da80b3412cd1b371c56f5f359c98b39b86179f35c9/cwclientlib-0.6.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ed726a44d19b5299bbc7513ce749fcc", "sha256": "72b315702c5ceb765f167c79b4d018f802cd17d5c297c7ff5330c9e30d7f4932" }, "downloads": -1, "filename": "cwclientlib-0.6.0.tar.gz", "has_sig": false, "md5_digest": "5ed726a44d19b5299bbc7513ce749fcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33584, "upload_time": "2018-06-12T14:32:58", "url": "https://files.pythonhosted.org/packages/95/55/bf0e9be778be0ba721da80b3412cd1b371c56f5f359c98b39b86179f35c9/cwclientlib-0.6.0.tar.gz" } ] }