Created
December 20, 2018 01:50
-
-
Save emmanuj/0bde6dec96d94caaa3b8c78e5e586ede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def submitGoogleRequest(RecordBean record, String callback_headers) throws IOException { | |
String query = "${record.getName()} ${record.getCompany()} ${GOOGLE_QUERY_SUFFIX}" | |
final URI google_uri = new URIBuilder() | |
.setScheme("https") | |
.setHost(GOOGLE_URL) | |
.setParameter("q",query).build() | |
final URI uri = new URIBuilder() | |
.setScheme("https") | |
.setHost(proxyCrawlHost) | |
.setParameter("token", token) | |
.setParameter("callback", "true") | |
.setParameter("crawler", "Google") | |
.setParameter("callback_headers", callback_headers) | |
.setParameter("url", google_uri.toString()) | |
.setParameter("format", "json") | |
.build() | |
Request request = new Request.Builder() | |
.url(uri.toString()) | |
.get() | |
.build() | |
Response response = httpClient.newCall(request).execute() | |
return response.body().string() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment