def get_title(self, url): key = self.create_title_key(url) value = memcache.get(key) if value is None: # MEMO: 1度だけ再試行する try: value = HatenaBookmark.get_title(url, self.username, self.password) except urlfetch.DownloadError: logging.info("retry download") value = HatenaBookmark.get_title(url, self.username, self.password) memcache.add(key, value, self.ttl) return value
def get_summary(self, url): key = self.create_summary_key(url) value = memcache.get(key) if value is None: # MEMO: 1度だけ再試行する try: value = HatenaBookmark.get_summary(url) except urlfetch.DownloadError: logging.info("retry download") value = HatenaBookmark.get_summary(url) if value == (None, None): ttl = self.ttl_negative else: ttl = self.ttl memcache.add(key, value, ttl) return value