@@ -54,7 +54,16 @@ class Folio():
5454 '''Interface to a FOLIO server using Okapi.'''
5555
5656 def __init__ (self , okapi_url , okapi_token , tenant_id , an_prefix ):
57- '''Create an interface to the Folio server at "okapi_url".'''
57+ '''Create an interface to the Folio server at "okapi_url".
58+
59+ The parameters define certain things Pokapi can't get on its own.
60+ These are: the the Okapi URL for your instance, an Okapi API token, a
61+ tenant id, and the prefix that appears in front of your accession
62+ numbers. (As an example of a prefix for accession numbers, for
63+ Caltech the prefix is the 'clc' part of an accession number such as
64+ 'clc.025d49d5.735a.4d79.8889.c5895ac65fd2'.)
65+ '''
66+
5867 self .okapi_url = okapi_url
5968 self .okapi_token = okapi_token
6069 self .tenant_id = tenant_id
@@ -63,8 +72,22 @@ def __init__(self, okapi_url, okapi_token, tenant_id, an_prefix):
6372
6473 def record (self , barcode = None , accession_number = None , instance_id = None ,
6574 raw_json = None ):
66- '''Create a FolioRecord object given a barcode, accession number, or
67- instance id. The arguments are mutually exclusive.
75+ '''Create a FolioRecord object.
76+
77+ The arguments are mutually exclusive; callers must supply only one
78+ of the following:
79+
80+ * 'barcode': retrieve the record corresponding to the given item
81+ barcode
82+
83+ * 'instance_id': retrieve the record having the given FOLIO
84+ instance identifier
85+
86+ * 'accession_number': retrieve the record corresponding to the
87+ accession number
88+
89+ * 'raw_json': (for advanced uses) the JSON content returned by
90+ FOLIO for an instance record, for example from a past call
6891
6992 This contacts the FOLIO server and perform a search using the given
7093 identifier, then creates a FolioRecord object and returns it. If
@@ -73,6 +96,7 @@ def record(self, barcode = None, accession_number = None, instance_id = None,
7396
7497 If no argument is given, this returns an empty FolioRecord.
7598 '''
99+
76100 args = [barcode , accession_number , instance_id , raw_json ]
77101 if sum (map (bool , args )) > 1 :
78102 raise ValueError (f'Keyword args to record() are mutually exclusive.' )
@@ -206,6 +230,7 @@ def cleaned(text):
206230
207231
208232def pub_year (publication_list ):
233+ '''Return the publication year of the first entry in the publication list.'''
209234 if publication_list :
210235 year = publication_list [0 ]['dateOfPublication' ]
211236 return '' .join (filter (str .isdigit , year ))
@@ -214,6 +239,7 @@ def pub_year(publication_list):
214239
215240
216241def publisher (publication_list ):
242+ '''Return the publisher name of the first entry in the publication list.'''
217243 if publication_list :
218244 return publication_list [0 ]['publisher' ]
219245 else :
0 commit comments