Ejemplo n.º 1
0
def test(fname):
    f = open(fname, "r")  #'samples/abstract.txt')
    xmlstr = f.read()
    f.close()
    articles = articles_for_pubmed_efetch(xmlstr)
    for a in articles:
        print a
Ejemplo n.º 2
0
def pubmed_efetch(pmidset, ckpoint=True):
    rp = initreqparams()
    rp["id"] = ",".join(pmidset)

    req = urllib2.Request(EFETCH, urllib.urlencode(rp))

    try:
        res = urllib2.urlopen(req)
    except HTTPError:
        return None
    except:
        return None

    xmlstr = res.read()
    articles = articles_for_pubmed_efetch(xmlstr)

    return articles