[TOC]
authors:
A few web api tools for search request to different webservices. All request will be cached, therefore server traffic is reduced.
For some of the webservices you need API keys, that were configured in api_keys.json
or
can be setted in each instance with set_api_key(KEY)
The easy way is to create the api_keys.json
file with the following content, you can use api_keys.json.example
:
{
"freebase": "KEY",
"chatnoir2": "dev",
"chatnoir": "KEY"
}
- chatnoir & chatnoir2 (non public)
- freebase & wikidata: semantic web search requests
- google: google search scraped form html page
- netspeak: ngram queries
- querysegmentation: segments queries
- whatismyip: get external ip address
- randomorg: get a true random number
Just call:
./example.py hello world
and you will get something like:
wikidata
{
"search": [
{
"id": "Q2471943",
"label": "Hello World",
"match": {
"language": "en",
"text": "Hello World",
"type": "label"
},
"url": "//www.wikidata.org/wiki/Q2471943"
},
.....
],
"searchinfo": {
"search": "hello world"
},
"success": 1
}
querysegmentation
{
"hyb-a": "hello|world",
"hyb-b": "hello|world",
"hyb-i": "hello|world",
"naive": "hello|world",
"wiki-based": "hello|world",
"wt-baseline": "hello|world",
"wt-snp-baseline": "hello|world"
}
google
[
{
"link": "https://de.wikipedia.org/wiki/Hallo-Welt-Programm&sa=U&ved=0CBQQFjAAahUKEwjBjJnCvrfHAhVJNxQKHf-8BMs&usg=AFQjCNEC-7j-QshsfJN5sDttc_1DtYuIKw\"",
"title": "Hallo-Welt-Programm Wikipedia"
},
...
]
as output.