Taza
Taza is a Python library with a set of abstractions over Tacyt that provides an OO layer over the query language.
Instalation
Install via pip
pip install taza
The libraries for tacyt are vendored inside taza, this is because the Tacyt python client is not distributed using pip.
Usage
The library has currently two main components, the wrapper for the API and the query abstractions.
To use the API wrapper you must instantiate a TazaClient class.
from taza.tacyt.TacytApp import TacytApp
from taza import TazaClient
app = TacytApp(APP_ID, SECREY_KEY)
client = TazaClient(app)
Clients can also be instantiated with a factory method that wraps the TacytApp class. Removing the need of importing Tacyt to the current script.
from taza import TazaClient
client = TazaClient.from_credentials(APP_ID, SECRET_KEY)
Querying tacyt
You can send queries to tacyt for searching apps throught the search_apps_with_query method. This method will handle pagination automatically. It returns a generators, so no query is actually made until the data is collected.
For example, let’s get the SHA256 hash of the apk of whatsapp.
from taza import TazaClient
client = TazaClient.from_credentials(APP_ID, SECRET_KEY)
query = "packageName:com.whatsapp AND origin:GooglePlay"
fields = ["sha256"]
apps = client.search_apps_with_query(query, fields) # No actual connection to Tacyt done here.
for app in apps: # Now the generator starts yielding and therefore connecting to Tacyt.
print(app)
Query language abstraction
The queries are send as a string to Tacyt, this means that the queries must be managed as strings, which sometimes can get messy. Taza has an OO abstraction that allows to write queries in Python.
First, each predicate can he specified with the cond class. There are shorthands for common predicates (at least common to me).
from taza.query import cond, packageName, fromGooglePlay
q1 = cond('packageName', 'com.company.awesome_app')
q2 = packageName('com.company.awesome_app')
str(q1) # => "packageName:com.company.awesome_app"
str(q2) # => "packageName:com.company.awesome_app"
str(fromGooglePlay) => "origin:GooglePlay"
assert str(q1) == str(q2)
The predicates can be combined with AND, OR and NOT operators.
from taza.query import cond, packageName, fromGooglePlay
q1 = cond('packageName', 'com.company.awesome_app')
q2 = packageName('com.company.awesome_app')
str(q1 & fromGooglePlay) # => "packageName:com.company.awesome_app AND origin:GooglePlay"
str(q2 | -fromGooglePlay) # => "packageName:com.company.awesome_app OR -origin:GooglePlay"
Bear in mind that Tacyt only allows up to 40 predicates per query.
If you need to agreggate several predicates under the same operator, you can use the or_many and and_many functions. They are usefull if you need to define the query programatically under a set of elements.
from taza.query import cond, packageName, fromGooglePlay
q1 = packageName("app1")
q2 = packageName("app2")
q3 = packageName("app3")
assert or_many(q1, q2, q3) == (q1 | q2 | q3)
qs = [fromGooglePlay, cond('versionCode', '42'), packageName('my.another.app')]
assert and_many(*qs) == (fromGooglePlay & cond('versionCode', '42') & packageName('my.another.app'))
These queries are sent to the search_apps_with_query method in the same way that string based queries are sent. The whatsapp example could be rewritten as such.
from taza import TazaClient
from taza.query import packageName, fromGooglePlay
client = TazaClient.from_credentials(APP_ID, SECRET_KEY)
query = packageName('com.whatsapp') & fromGooglePlay
fields = ["sha256"]
apps = client.search_apps_with_query(query, fields) # No actual connection to Tacyt done here.
for app in apps: # Now the generator starts yielding and therefore connecting to Tacyt.
print(app)
Metadata
Release files for taza 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| taza-2.0.0.tar.gz | 15.4 kB | Without provenance | Details for taza-2.0.0.tar.gz |
Release files / taza-2.0.0.tar.gz
| Download URL | taza-2.0.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22abae5241b4420f9836aea40dece4d7669b4aa24b71a663597970029c4fc87a
|
|
BLAKE2b-256 checksum How to use checksums |
a3e9de8f4c6c349be6cbda53c9e1551eda45f85259484010211052c76d9ce794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.5
|
Security for taza 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.