
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
This is a simple Python client for the Media Cloud CLIFF-CLAVIN geocoder.
If you just want to use this library to talk to a CLIFF server you have running somewhere, first install it
pip install mediacloud-cliff
Then instantiate and use it like this:
from cliff.api import Cliff
my_cliff = Cliff('http://myserver.com:8080')
my_cliff.parse_text("This is about Einstien at the IIT in New Delhi.")
This will return results like this:
{
"results": {
"organizations": [
{
"count": 1,
"name": "IIT"
}
],
"places": {
"focus": {
"cities": [
{
"id": 1261481,
"lon": 77.22445,
"name": "New Delhi",
"score": 1,
"countryGeoNameId": "1269750",
"countryCode": "IN",
"featureCode": "PPLC",
"featureClass": "P",
"stateCode": "07",
"lat": 28.63576,
"stateGeoNameId": "1273293",
"population": 317797
}
],
"states": [
{
"id": 1273293,
"lon": 77.1,
"name": "National Capital Territory of Delhi",
"score": 1,
"countryGeoNameId": "1269750",
"countryCode": "IN",
"featureCode": "ADM1",
"featureClass": "A",
"stateCode": "07",
"lat": 28.6667,
"stateGeoNameId": "1273293",
"population": 16787941
}
],
"countries": [
{
"id": 1269750,
"lon": 79,
"name": "Republic of India",
"score": 1,
"countryGeoNameId": "1269750",
"countryCode": "IN",
"featureCode": "PCLI",
"featureClass": "A",
"stateCode": "00",
"lat": 22,
"stateGeoNameId": "",
"population": 1173108018
}
]
},
"mentions": [
{
"id": 1261481,
"lon": 77.22445,
"source": {
"charIndex": 37,
"string": "New Delhi"
},
"name": "New Delhi",
"countryGeoNameId": "1269750",
"countryCode": "IN",
"featureCode": "PPLC",
"featureClass": "P",
"stateCode": "07",
"confidence": 1,
"lat": 28.63576,
"stateGeoNameId": "1273293",
"population": 317797
}
]
},
"people": [
{
"count": 1,
"name": "Einstien"
}
]
},
"status": "ok",
"milliseconds": 22,
"version": "2.6.0"
}
You can also just get info from the GeoNames database inside CLIFF:
from cliff.api import Cliff
my_cliff = Cliff('http://myserver.com:8080')
my_cliff.geonames_lookup(4943351)
This will give you results like this:
{
"results": {
"id": 4943351,
"lon": -71.09172,
"name": "Massachusetts Institute of Technology",
"countryGeoNameId": "6252001",
"countryCode": "US",
"featureCode": "SCH",
"featureClass": "S",
"parent": {
"id": 4943909,
"lon": -71.39184,
"name": "Middlesex County",
"countryGeoNameId": "6252001",
"countryCode": "US",
"featureCode": "ADM2",
"featureClass": "A",
"parent": {
"id": 6254926,
"lon": -71.10832,
"name": "Massachusetts",
"countryGeoNameId": "6252001",
"countryCode": "US",
"featureCode": "ADM1",
"featureClass": "A",
"parent": {
"id": 6252001,
"lon": -98.5,
"name": "United States",
"countryGeoNameId": "6252001",
"countryCode": "US",
"featureCode": "PCLI",
"featureClass": "A",
"stateCode": "00",
"lat": 39.76,
"stateGeoNameId": "",
"population": 310232863
},
"stateCode": "MA",
"lat": 42.36565,
"stateGeoNameId": "6254926",
"population": 6433422
},
"stateCode": "MA",
"lat": 42.48555,
"stateGeoNameId": "6254926",
"population": 1503085
},
"stateCode": "MA",
"lat": 42.35954,
"stateGeoNameId": "6254926",
"population": 0
},
"status": "ok",
"version": "2.6.0"
}
If you want to work on this API client, then first clone the source repo from GitHub and install the dependencies
nmake install
Then make a .env
file in this directory and put the url to your CLIFF server in it:
CLIFF_URL=http://localhost:8080
make test
to make sure all the test passcliff/__init__.py
make build-release
to create an install packagemake release-test
to upload it to PyPI's test platformmake release
to upload it to PyPImediacloud
naming, underscored method names, remove deprecated NLP endpointgeonamesLookup
helper)FAQs
Media Cloud CLIFF API Client Library
We found that mediacloud-cliff demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.