Latest version via pypi
ioverka opened this issue · 3 comments
Hi,
thanks a lot for sharing the wos client. Could you maybe push the latest changes to pypi? Or is the revised query method still in development?
thanks,
inga
Hi ioverka,
I was waiting feedbacks from the original PR proposer @guilhermeleobas, but you are also welcome to test the changes. You can use pip to install the latest versione with:
pip install git+https://github.com/enricobacis/wos.git@master
Let me know if it works as expected and I'll push it to PyPI.
Thanks so much for the swift response! The revised query method seems to work fine - I was able to download about 5000 records from WoS before stumbling about the encoding problem, see #6
One remark: I replaced
return [el.text for el in xml.findall(xml_query)]`
by
return [el for el in xml.findall(xml_query)]`
in the single method to be able to use the XML query to access attributes from the elements, e.g.
results = query(wos_client, query_string, xml_query='./REC/dynamic_data/cluster_related/identifiers/identifier[@type="doi"]', count=num_results)
for child in results:
print child.attrib['value']
Perfect, I have just uploaded the new (0.1.9 version) on PyPI, thank you for your help.
Your other proposal would have probably been a better design. At the moment in fact in order to do what you asked you need to parse the xml again.
Nevertheless, I prefer not to change the APIs in a non backward-compatible way. If you think it is useful, please submit a PR where the option to specify whether to extract the text or to return the elements as they are is specified in a keyword parameter of the single
function.