factual-api

Factual's official Python driver for the Factual public API
Download

factual-api Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Factual Driver Team
  • Publisher web site:
  • http://github.com/Factual/

factual-api Tags


factual-api Description

factual-api is the Factual supported Python driver for Factual's public API.This API supports queries to Factual's Read, Schema, Crosswalk, and Resolve APIs. Full documentation is available on the Factual website:- Read: Search the data- Schema: Get table metadata- Crosswalk: Get third-party IDs- Resolve: Enrich your data and match it against Factual'sThis driver is supported via the Factual Developer Group.Basic DesignThe driver allows you to create an authenticated handle to Factual. With a Factual handle, you can send queries and get results back.Queries are created using the Factual handle, which provides a fluent interface to constructing your queries.TablesThe Factual API is a generic API that sits over all tables available via the Factual v3 API. Some popular ones:- Table global for international places- Table restaurants-us for US restaurants only- Table places for US places onlySetupObtain an OAuth key and secret from Factualexample.py is provided with the driver as a reference.To get started, import the Factual python driver module and create a Factual object using your OAuth key and secret.from factual import *factual = Factual(KEY, SECRET)Simple Read Examples# Return entities from the Places dataset with names beginning with "starbucks"factual.table("places").filters({"name":{"$bw":"starbucks"}}).data()# Return entity names and non-blank websites from the Global dataset, for entities located in Thailandfactual.table("global").select("name,website").filters( {"$and":}).data()# Return highly rated U.S. restaurants in Los Angeles with WiFifactual.table("restaurants-us").filters( {"$and":}).data()Simple Crosswalk Example# Concordance information of a placeFACTUAL_ID = "110ace9f-80a7-47d3-9170-e9317624ebd9"query = factual.crosswalk().factual_id(FACTUAL_ID)query.data()# Or specify a place with its namespace_id and namespaceSIMPLEGEO_ID = "SG_6XIEi3qehN44LH8m8i86v0"query = factual.crosswalk().namespace('simplegeo',SIMPLEGEO_ID)query.data()Simple Resolve Example# Returns resolved entities as an array of hashesquery = factual.resolve({"name":"McDonalds","address":"10451 Santa Monica Blvd","region":"CA","postcode":"90025"})query.data() # true or falsequery.data()Full DocumentationFull documentation is available at http://developer.factual.comProduct's homepage


factual-api Related Software