Пример #1
0
	def bidref(self,bid):
		'''Get reference information from bing ID'''
		requestsSession = requests.Session()
		requestsSession.mount('http://', requests.adapters.HTTPAdapter(max_retries=5))
		try:
			params={"type":"endnote"}
			r=requestsSession.get("http://mylib.chinacloudsites.cn/Paper/Citation/"+str(bid),params=params,headers=self.hdr,timeout=20)
			print "get ref time:",r.elapsed
			sys.stdout.flush()
			if (r.status_code is 200):
				j=Jrecord()
				return j.parseenw(r.text)
			return Jrecord()
		except requests.exceptions.ConnectionError:
			print "ConnectionError: Fail to find ref info for bid: "+bid
			return Jrecord()