Пример #1
0
 def get_data(self,
              query=None,
              cache_timeout=CACHE_TIMEOUT):
     """
     Get and process the data from the API and store in Python dictionary.
     This data is where any caching should take place.  
     """
     #See if this view has created a resource already.
     try:
         query = self.resource.query
     except:
         #If no query is passed in, use the self.scrubbed_query property
         if query is None:
             query = self.scrub_query()
         #Get or make resource
         resource = self.make_resource(query)
         self.resource = resource
         
     cache_key = "resolved-%s" % self.resource.id
     data = cache.get(cache_key, None)
     if not data:
         data = get_sersol_data(query, key=SERSOL_KEY, timeout=SERSOL_TIMEOUT)
         cache.set(cache_key, data, cache_timeout)
     return data
Пример #2
0
 def setUp(self):
     ourl = 'title=Organic%20Letters&date=2008&issn=1523-7060&issue=19&spage=4155'
     self.data = get_sersol_data(ourl, key=KEY)
     self.sersol = Resolved(self.data)
Пример #3
0
 def setUp(self):
     ourl = 'rft_id=info:doi/10.1016/j.neuroimage.2009.12.024'
     data = get_sersol_data(ourl, key=KEY)
     self.sersol = Resolved(data)
Пример #4
0
 def setUp(self):
     ourl = 'id=pmid:19282400&sid=Entrez:PubMed'
     data = get_sersol_data(ourl, key=KEY)
     self.sersol = Resolved(data)
Пример #5
0
 def setUp(self):
     #Sample passed from OCLC
     ourl = 'sid=FirstSearch%3AMEDLINE&genre=article&issn=0037-9727&atitle=Serum+and+urine+chromium+as+indices+of+chromium+status+in+tannery+workers.&title=Proceedings+of+the+Society+for+Experimental+Biology+and+Medicine.+Society+for+Experimental+Biology+and+Medicine+%28New+York%2C+N.Y.%29&volume=185&issue=1&spage=16&epage=23&date=1987&aulast=Randall&aufirst=JA&sici=0037-9727%28198705%29185%3A1%3C16%3ASAUCAI%3E2.0.TX%3B2-3&id=doi%3A&pid=%3Caccession+number%3E114380499%3C%2Faccession+number%3E%3Cfssessid%3E0%3C%2Ffssessid%3E&url_ver=Z39.88-2004&rfr_id=info%3Asid%2Ffirstsearch.oclc.org%3AMEDLINE&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&req_dat=%3Csessionid%3E0%3C%2Fsessionid%3E&rfe_dat=%3Caccessionnumber%3E114380499%3C%2Faccessionnumber%3E&rft_id=urn%3AISSN%3A0037-9727&rft.aulast=Randall&rft.aufirst=JA&rft.atitle=Serum+and+urine+chromium+as+indices+of+chromium+status+in+tannery+workers.&rft.jtitle=Proceedings+of+the+Society+for+Experimental+Biology+and+Medicine.+Society+for+Experimental+Biology+and+Medicine+%28New+York%2C+N.Y.%29&rft.date=1987&rft.volume=185&rft.issue=1&rft.spage=16&rft.epage=23&rft.issn=0037-9727&rft.genre=article&rft.sici=0037-9727%28198705%29185%3A1%3C16%3ASAUCAI%3E2.0.TX%3B2-3&checksum=2a13709e5b9664e62d31e421f6f77c94&title=Brown University&linktype=openurl&detail=RBN'
     self.data = get_sersol_data(ourl, key=KEY)
     self.sersol = Resolved(self.data)
Пример #6
0
 def setUp(self):
     #Sample passed from OCLC
     ourl = 'sid=FirstSearch%3AWorldCat&genre=book&isbn=9780394565279&title=The+risk+pool&date=1988&aulast=Russo&aufirst=Richard&id=doi%3A&pid=%3Caccession+number%3E17803510%3C%2Faccession+number%3E%3Cfssessid%3E0%3C%2Ffssessid%3E%3Cedition%3E1st+ed.%3C%2Fedition%3E&url_ver=Z39.88-2004&rfr_id=info%3Asid%2Ffirstsearch.oclc.org%3AWorldCat&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&req_dat=%3Csessionid%3E0%3C%2Fsessionid%3E&rfe_dat=%3Caccessionnumber%3E17803510%3C%2Faccessionnumber%3E&rft_id=info%3Aoclcnum%2F17803510&rft_id=urn%3AISBN%3A9780394565279&rft.aulast=Russo&rft.aufirst=Richard&rft.btitle=The+risk+pool&rft.date=1988&rft.isbn=9780394565279&rft.place=New+York&rft.pub=Random+House&rft.edition=1st+ed.&rft.genre=book&checksum=d6c1576188e0f87ac13f4c4582382b4f&title=Brown University&linktype=openurl&detail=RBN'
     self.data = get_sersol_data(ourl, key=KEY)
     self.sersol = Resolved(self.data)