def get(self): # Check if there was anything new on PubMed yesterday. yesterday = date.today() - timedelta(1) try: eUtils.get_hit_count_or_raise(term=yesterday.strftime("%Y%%2F%m%%2F%d[crdt]"), email=config.ADMAIL) except eUtils.PubMedException, eUtils.NoHitException: # No hit, or PubMed is not working. logging.warn("no new record on PubMed") return
def test_get_hit_count_or_raise(self): # The following should not raise any exception and return # many hits (there were about 3620 records added to PubMed on # April 13, 2013 but the exact number can change). counts = eUtils.get_hit_count_or_raise(u'2013/04/13[crdt]') self.assertTrue(counts > 0)