{ "info": { "author": "Daniel Dom\u00ednguez", "author_email": "daniel.dominguez@imdea.org", "bugtrack_url": null, "classifiers": [], "description": "Taza\n====\n\nTaza is a Python library with a set of abstractions over Tacyt that\nprovides an OO layer over the query language.\n\nInstalation\n~~~~~~~~~~~\n\nInstall via pip\n\n::\n\n pip install taza\n\nThe libraries for tacyt are vendored inside taza, this is because the\nTacyt python client is not distributed using pip.\n\nUsage\n~~~~~\n\nThe library has currently two main components, the wrapper for the API\nand the query abstractions.\n\nTo use the API wrapper you must instantiate a ``TazaClient`` class.\n\n.. code:: python\n\n from taza.tacyt.TacytApp import TacytApp\n from taza import TazaClient\n\n app = TacytApp(APP_ID, SECREY_KEY)\n client = TazaClient(app)\n\nClients can also be instantiated with a factory method that wraps the\nTacytApp class. Removing the need of importing Tacyt to the current\nscript.\n\n.. code:: python\n\n from taza import TazaClient\n\n client = TazaClient.from_credentials(APP_ID, SECRET_KEY)\n\nQuerying tacyt\n^^^^^^^^^^^^^^\n\nYou can send queries to tacyt for searching apps throught the\n``search_apps_with_query`` method. This method will handle pagination\nautomatically. It returns a generators, so no query is actually made\nuntil the data is collected.\n\nFor example, let\u2019s get the SHA256 hash of the apk of whatsapp.\n\n.. code:: python\n\n from taza import TazaClient\n\n client = TazaClient.from_credentials(APP_ID, SECRET_KEY)\n\n query = \"packageName:com.whatsapp AND origin:GooglePlay\"\n fields = [\"sha256\"]\n\n apps = client.search_apps_with_query(query, fields) # No actual connection to Tacyt done here.\n\n for app in apps: # Now the generator starts yielding and therefore connecting to Tacyt.\n print(app)\n\nQuery language abstraction\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe queries are send as a string to Tacyt, this means that the queries\nmust be managed as strings, which sometimes can get messy. Taza has an\nOO abstraction that allows to write queries in Python.\n\nFirst, each predicate can he specified with the ``cond`` class. There\nare shorthands for common predicates (at least common to me).\n\n.. code:: python\n\n from taza.query import cond, packageName, fromGooglePlay\n\n q1 = cond('packageName', 'com.company.awesome_app')\n q2 = packageName('com.company.awesome_app')\n\n str(q1) # => \"packageName:com.company.awesome_app\"\n str(q2) # => \"packageName:com.company.awesome_app\"\n str(fromGooglePlay) => \"origin:GooglePlay\"\n\n assert str(q1) == str(q2)\n\nThe predicates can be combined with AND, OR and NOT operators.\n\n.. code:: python\n\n from taza.query import cond, packageName, fromGooglePlay\n\n q1 = cond('packageName', 'com.company.awesome_app')\n q2 = packageName('com.company.awesome_app')\n\n str(q1 & fromGooglePlay) # => \"packageName:com.company.awesome_app AND origin:GooglePlay\"\n str(q2 | -fromGooglePlay) # => \"packageName:com.company.awesome_app OR -origin:GooglePlay\"\n\nBear in mind that Tacyt only allows up to 40 predicates per query.\n\nIf you need to agreggate several predicates under the same operator, you\ncan use the ``or_many`` and ``and_many`` functions. They are usefull if\nyou need to define the query programatically under a set of elements.\n\n.. code:: python\n\n from taza.query import cond, packageName, fromGooglePlay\n\n q1 = packageName(\"app1\")\n q2 = packageName(\"app2\")\n q3 = packageName(\"app3\")\n\n assert or_many(q1, q2, q3) == (q1 | q2 | q3)\n\n qs = [fromGooglePlay, cond('versionCode', '42'), packageName('my.another.app')]\n assert and_many(*qs) == (fromGooglePlay & cond('versionCode', '42') & packageName('my.another.app'))\n\nThese queries are sent to the ``search_apps_with_query`` method in the\nsame way that string based queries are sent. The whatsapp example could\nbe rewritten as such.\n\n.. code:: python\n\n from taza import TazaClient\n from taza.query import packageName, fromGooglePlay\n\n client = TazaClient.from_credentials(APP_ID, SECRET_KEY)\n\n query = packageName('com.whatsapp') & fromGooglePlay\n fields = [\"sha256\"]\n\n apps = client.search_apps_with_query(query, fields) # No actual connection to Tacyt done here.\n\n for app in apps: # Now the generator starts yielding and therefore connecting to Tacyt.\n print(app)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.software.imdea.org/android/taza", "keywords": "mobile tacyt android", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "taza", "package_url": "https://pypi.org/project/taza/", "platform": "", "project_url": "https://pypi.org/project/taza/", "project_urls": { "Homepage": "https://gitlab.software.imdea.org/android/taza" }, "release_url": "https://pypi.org/project/taza/1.1.1/", "requires_dist": null, "requires_python": "", "summary": "A set of classes and abstractions for working with Tacyt", "version": "1.1.1" }, "last_serial": 5381961, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "4d3dd01b8b2b069cc46b88c876e09b19", "sha256": "8ff4d73258023c8edabdb1b79670e991865bb455dec0855c436a5442898f3ded" }, "downloads": -1, "filename": "taza-1.0.0.tar.gz", "has_sig": false, "md5_digest": "4d3dd01b8b2b069cc46b88c876e09b19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14593, "upload_time": "2019-02-06T09:59:03", "url": "https://files.pythonhosted.org/packages/21/f5/01e7c2696aa1a0d34dca9f52c076445a09373646678ae8cab46ced02ee46/taza-1.0.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "5b5794ac0d7de4cbd4443d07532c4cda", "sha256": "90fd47787369bb6d432cbaf5226207e804101e656abc484fadfe9c14c9db604e" }, "downloads": -1, "filename": "taza-1.1.1.macosx-10.14-x86_64.tar.gz", "has_sig": false, "md5_digest": "5b5794ac0d7de4cbd4443d07532c4cda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27018, "upload_time": "2019-06-10T15:48:04", "url": "https://files.pythonhosted.org/packages/f4/69/93927d329165a093b10c0caa7ec509c6fd1371d53a9e1a3791d6f1061585/taza-1.1.1.macosx-10.14-x86_64.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5b5794ac0d7de4cbd4443d07532c4cda", "sha256": "90fd47787369bb6d432cbaf5226207e804101e656abc484fadfe9c14c9db604e" }, "downloads": -1, "filename": "taza-1.1.1.macosx-10.14-x86_64.tar.gz", "has_sig": false, "md5_digest": "5b5794ac0d7de4cbd4443d07532c4cda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27018, "upload_time": "2019-06-10T15:48:04", "url": "https://files.pythonhosted.org/packages/f4/69/93927d329165a093b10c0caa7ec509c6fd1371d53a9e1a3791d6f1061585/taza-1.1.1.macosx-10.14-x86_64.tar.gz" } ] }