-
-
Save domoritz/2012629 to your computer and use it in GitHub Desktop.
Web of Science API access with ruby, python and php libs
This file contains hidden or 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
<?php | |
$auth_url = "http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl"; | |
$auth_client = @new SoapClient($auth_url); | |
$auth_response = $auth_client->authenticate(); | |
$search_url = "http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl"; | |
$search_client = @new SoapClient($search_url); | |
$search_client->__setCookie('SID',$auth_response->return); | |
$search_array = array( | |
'queryParameters' => array( | |
'databaseID' => 'WOS', | |
'userQuery' => 'AU=Douglas T*', | |
'editions' => array( | |
array('collection' => 'WOS', 'edition' => 'SSCI'), | |
array('collection' => 'WOS', 'edition' => 'SCI') | |
), | |
'queryLanguage' => 'en' | |
), | |
'retrieveParameters' => array( | |
'count' => '5', | |
'fields' => array( | |
array('name' => 'Date', 'sort' => 'D') | |
), | |
'firstRecord' => '1' | |
) | |
); | |
try{ | |
$search_response = $search_client->search($search_array); | |
} catch (Exception $e) { | |
echo $e->getMessage(); | |
} | |
print_r($search_response); | |
?> |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from suds.client import Client | |
from suds.transport.http import HttpTransport | |
import urllib2 | |
class HTTPSudsPreprocessor(urllib2.BaseHandler): | |
def __init__(self, SID): | |
self.SID = SID | |
def http_request(self, req): | |
req.add_header('cookie', 'SID="'+self.SID+'"') | |
return req | |
https_request = http_request | |
class WokmwsSoapClient(): | |
""" | |
main steps you have to do: | |
soap = WokmwsSoapClient() | |
results = soap.search(...) | |
""" | |
def __init__(self): | |
self.url = self.client = {} | |
self.SID = '' | |
self.url['auth'] = 'http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl' | |
self.url['search'] = 'http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl' | |
self.prepare() | |
def __del__(self): | |
self.close() | |
def prepare(self): | |
"""does all the initialization we need for a request""" | |
self.initAuthClient() | |
self.authenticate() | |
self.initSearchClient() | |
def initAuthClient(self): | |
self.client['auth'] = Client(self.url['auth']) | |
def initSearchClient(self): | |
http = HttpTransport() | |
opener = urllib2.build_opener(HTTPSudsPreprocessor(self.SID)) | |
http.urlopener = opener | |
self.client['search'] = Client(self.url['search'], transport = http) | |
def authenticate(self): | |
self.SID = self.client['auth'].service.authenticate() | |
def close(self): | |
self.client['auth'].service.closeSession() | |
def search(self, query): | |
qparams = { | |
'databaseID' : 'WOS', | |
'userQuery' : query, | |
'queryLanguage' : 'en', | |
'editions' : [{ | |
'collection' : 'WOS', | |
'edition' : 'SCI', | |
},{ | |
'collection' : 'WOS', | |
'edition' : 'SSCI', | |
}] | |
} | |
rparams = { | |
'count' : 5, # 1-100 | |
'firstRecord' : 1, | |
'fields' : [{ | |
'name' : 'Relevance', | |
'sort' : 'D', | |
}], | |
} | |
return self.client['search'].service.search(qparams, rparams) |
This file contains hidden or 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
require 'savon' | |
require 'handsoap' | |
require 'pp' | |
class Soapy | |
def initialize(opts) | |
@client = Savon::Client | |
@auth_url = opts[:auth_url] || | |
"http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl" | |
@search_url = opts[:search_url] || | |
"http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl" | |
@search_xml = opts[:search_xml] || | |
<<-EOF | |
<queryParameters> | |
<databaseID>WOS</databaseID> | |
<userQuery>AU=Douglas T*</userQuery> | |
<editions> | |
<collection>WOS</collection> | |
<edition>SSCI</edition> | |
</editions> | |
<editions> | |
<collection>WOS</collection> | |
<edition>SCI</edition> | |
</editions> | |
<queryLanguage>en</queryLanguage> | |
</queryParameters> | |
<retrieveParameters> | |
<count>5</count> | |
<fields> | |
<name>Date</name> | |
<sort>D</sort> | |
</fields> | |
<firstRecord>1</firstRecord> | |
</retrieveParameters> | |
EOF | |
end | |
def authenticate(auth_url=@auth_url) | |
@auth_client ||= @client.new(@auth_url) | |
@auth_client.request :authenticate | |
@session_cookie = @auth_client.http.headers["Cookie"] | |
@search_client.http.headers["Cookie"] = @session_cookie if @search_client | |
end | |
def search(query=@search_xml) | |
@search_client ||= @client.new(@search_url) | |
authenticate if @session_cookie.nil? | |
@last_search = @search_client.request(:search) { soap.body = query} | |
end | |
def destroy | |
@auth_client.request :close_session | |
end | |
end | |
# Savon | |
soap = Soapy.new | |
pp soap.search | |
# Handsoap | |
# So... the Handsoap API turned out to be a pain, so let's just use Savon. |
waynewu2019
commented
Nov 21, 2020
via email
Hi Dom,
I was told the followings …
WoS restful
Please note that you have been provided access to the new REST web services. https://pypi.org/project/wos/ <https://pypi.org/project/wos/> is for the older WOS web Service (SOAP). You need to look for an API for REST such as https://github.com/ConnectedSystems/restful-wos <https://github.com/ConnectedSystems/restful-wos> or look at samples here :
https://github.com/Clarivate-SAR/ <https://github.com/Clarivate-SAR/>
Do you have an example on how to use the REST web service?
Thanks again,
Wayne
… On Nov 21, 2020, at 4:46 AM, Zafer Akçalı ***@***.***> wrote:
@zakcali commented on this gist.
Thanks for the examples.
I created a nodejs code, retrieves records pages by page, matches Quartile values with journal issn/eissn codes by using a quartile dictionary created on 2020, then prints them:
https://github.com/zakcali/wos-lite-api-nodejs <https://github.com/zakcali/wos-lite-api-nodejs>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://gist.github.com/2012629#gistcomment-3535475>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ANEQXJ7IMOQZWFFKSVS6G7LSQ6D65ANCNFSM4T5VZQTA>.
No, did not tried REST web services yet.I will create an electron app, will use nodejs routines, and able to filter results according to quartiles, just like InCites
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment