PYKL
PYKL is the kltool for python, toolset for web, http, cache, dht, xml, json and so on.
Install it typing in your console:
pip install pykl
Usage
You can either do pykl --test to start a test server for testing queries or
pykl QUERY_FILE
This command will write in the standard output (or other output if specified via --output) the resulting JSON.
Your QUERY_FILE could look similar to this:
{
page(url:"http://news.ycombinator.com") {
items: query(selector:"tr.athing") {
rank: text(selector:"td span.rank")
title: text(selector:"td.title a")
sitebit: text(selector:"span.comhead a")
url: attr(selector:"td.title a", name:"href")
attrs: next {
score: text(selector:"span.score")
user: text(selector:"a:eq(0)")
comments: text(selector:"a:eq(2)")
}
}
}
}
Advanced usage
If you want to generalize your pykl query to any page, just rewrite your query file adding the $page var. So should look to something like this:
query ($page: String) {
page(url:$page) {
# ...
}
}
And then, query it like:
pykl QUERY_FILE http://news.ycombinator.com
Metadata
Release files for pykl 0.1.6
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 |
|---|---|---|---|---|
| pykl-0.1.6.zip | 61.4 kB | Without provenance | Details for pykl-0.1.6.zip |
Release files / pykl-0.1.6.zip
| Download URL | pykl-0.1.6.zip |
|---|---|
| Size | 61.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f54bd3176d8283de362a7c08007ccca687d7453e1f48f34af667badb10b2bf9
|
|
BLAKE2b-256 checksum How to use checksums |
5e2c245c1e4813b83656b72ce3138920972742eb8357a7c1e1b5a1c02e166f5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pykl 0.1.6
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.