Centralize Google API key
This commit is contained in:
parent
054ea643c3
commit
757c3e32ff
@ -35,12 +35,13 @@ package com.google.refine.freebase.model.recon;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.google.refine.freebase.util.FreebaseUtils;
|
||||
import com.google.refine.model.Recon;
|
||||
import com.google.refine.model.Recon.Judgment;
|
||||
import com.google.refine.model.recon.ReconConfig;
|
||||
|
||||
abstract public class StrictReconConfig extends ReconConfig {
|
||||
final static protected String s_mqlreadService = "https://www.googleapis.com/freebase/v1/mqlread?key=AIzaSyBAZ_EjMPKlOzyyZXv6JKXPPwJFISVji3M&";
|
||||
final static protected String s_mqlreadService = "https://www.googleapis.com/freebase/v1/mqlread?key=" + FreebaseUtils.API_KEY + "&";
|
||||
|
||||
static public ReconConfig reconstruct(JSONObject obj) throws Exception {
|
||||
String match = obj.getString("match");
|
||||
|
@ -80,15 +80,30 @@ public class FreebaseUtils {
|
||||
static final private int SAMPLE_SIZE = 300;
|
||||
static final private int JUDGES = 4;
|
||||
|
||||
public static final String API_KEY = "AIzaSyBAZ_EjMPKlOzyyZXv6JKXPPwJFISVji3M";
|
||||
|
||||
private static String getUserInfoURL(String host) {
|
||||
// TODO: Needs to be upgraded to new APIs sandbox-freebase.com as host becomes v1sandbox as version
|
||||
return "http://api." + host + "/api/service/user_info";
|
||||
}
|
||||
|
||||
private static String getMQLWriteURL(String host) {
|
||||
// TODO: Needs to be upgraded to new APIs
|
||||
// String version = "v1";
|
||||
// if (host != null && host.contains("sandbox")) {
|
||||
// version += "sandbox";
|
||||
// }
|
||||
// return "https://www.googleapis.com/freebase/"+version+"/mqlwrite?key=" + API_KEY + "&";
|
||||
return "http://api." + host + "/api/service/mqlwrite";
|
||||
}
|
||||
|
||||
private static String getMQLReadURL(String host) {
|
||||
// TODO: Needs to be upgraded to new APIs
|
||||
// String version = "v1";
|
||||
// if (host != null && host.contains("sandbox")) {
|
||||
// version += "sandbox";
|
||||
// }
|
||||
// return "https://www.googleapis.com/freebase/"+version+"/mqlread?key=" + API_KEY + "&";
|
||||
return "http://api." + host + "/api/service/mqlread";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user