Problem with urllib.urlopen()

Christopher chris_mk at hotmail.com
Mon Jun 3 18:45:29 EDT 2002


Hi all,

I'm having a bit of a problem and I'm not sure what I should do.  I've
tried a couple of things and I'm running out of ideas.

Basically, I want to be able to access, directly, the XML versions of
the NCBI results of a search.  There is a default display of 'Summary'
and then there are numberous other displays, one of which is 'XML' You
can view the following link in XML (sort of) merely by changing the
display option (that was just some backgroud info, nothing spectacular
that really matters).
 Here is a link to an example page (do a search, then click details,
then the URL button and PubMed gives the actual url it uses (otherwise
it is just a cgi url; got that from O'Reilly's "Developing
Bioinformatics Computer Skills": 
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=PureSearch&db=PubMed&details_term=%28%28%28%22organization%20and%20administration%22%5BMeSH%20Subheading%5D%20OR%20organ%5BText%20Word%5D%29%20AND%20%28%22diabetes%20mellitus%22%5BMeSH%20Terms%5D%20OR%20diabetes%5BText%20Word%5D%29%29%20AND%20%28%28%22glucagon%22%5BMeSH%20Terms%5D%20OR%20glucagon%5BText%20Word%5D%29%20AND%20%28%22insulin%22%5BMeSH%
0Terms%5D%20OR%20insulin%5BText%20Word%5D%29%29%29


Now, try this url in your webbrowser and see what you get (you should
see the actual xml version of the page above):
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Display&db=PubMed&details_term=%28%28%28%22organization%20and%20administration%22%5BMeSH%20Subheading%5D%20OR%20organ%5BText%20Word%5D%29%20AND%20%28%22diabetes%20mellitus%22%5BMeSH%20Terms%5D%20OR%20diabetes%5BText%20Word%5D%29%29%20AND%20%28%28%22glucagon%22%5BMeSH%20Terms%5D%20OR%20glucagon%5BText%20Word%5D%29%20AND%20%28%22insulin%22%5BMeSH%20T
rms%5D%20OR%20insulin%5BText%20Word%5D%29%29%29&dopt=XML&query_key=1

You should, like I said, get the XML version of the original links
(with some extra information, which is why I want to interface with
the XML site, btw).  Now, if you do an interface with Python instead
of your browser you get a response of an error page instead.  Why is
that and what can I do to change it?  If you have any information, I
would appreciate it ver much.  Thanks.

Chris



More information about the Python-list mailing list