Ejemplo n.º 1
0
def getPlaces(hmpage):

	query= "SELECT match.place.name FROM geo.placemaker WHERE documentURL = \"" + hmpage + "\" AND documentType=\"text/plain\" "
	placeurl= PUBLIC_API_URL + '?' + urllib.urlencode({ 'q': query, 'format': 'json', 'env': DATATABLES_URL })	
	placedata= rest.load(placeurl)	

	places= []		
	try:
		
		for p in placedata["query"]["results"]["matches"]:
			#print p["match"]["place"]["name"]
			places.append(p["match"]["place"]["name"])
		return places	
	except:
		return places
Ejemplo n.º 2
0
def getAuthors(query):

	qurl= PUBLIC_API_URL + '?' + urllib.urlencode({ 'q': query, 'format': 'json', 'env': DATATABLES_URL })	
	qdata= rest.load(qurl)
	authors= []

	for ele in qdata['query']['results']['p']:
		try:
			ele= ele.strip()		
			ele= ele.split(",")
			if len(ele)> 1:
				lst= ele.pop(-1)
				lst= lst.split("and")
				ele.extend(lst)
				authors.extend(ele)
		except:
			continue

	f = file('Authors.db','w')
	pickle.dump(authors, f)
	f.close()
Ejemplo n.º 3
0
def create(name="", data=None, url=None, keep_standards_prefix=False):
  d = data
  if url is not None:
    d = rest.load(url)
  return WebTable(name, d=d, keep_standards_prefix=keep_standards_prefix)
Ejemplo n.º 4
0
def create(name="", data=None, url=None, keep_standards_prefix=False):
  d = data
  if url is not None:
    d = rest.load(url)
  return WebTable(name, d=d, keep_standards_prefix=keep_standards_prefix)