Module Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Num Assign NameStore Str Assign NameStore TupleLoad Str Str Str Str Str Str Str Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad While CompareLt Call NameLoad NameLoad Num body Assign NameStore BinOpAdd Str NameLoad Return NameLoad decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Dict If BoolOpOr UnaryOpNot NameLoad UnaryOpNot NameLoad body Assign NameStore ListLoad Str Str orelse Assign NameStore ListLoad If NameLoad body Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Str orelse Assign NameStore Num Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Str If NameLoad body Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Str orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Str For NameStore BinOpAdd Call NameLoad BinOpAdd NameLoad Num NameLoad NameLoad body Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad NameLoad If NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword Num keyword NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore ListLoad If BoolOpOr NameLoad NameLoad body If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Str orelse If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad SubscriptLoad NameLoad Index Num TupleLoad NameLoad orelse Assign NameStore Num For NameStore NameLoad body Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Str NameLoad If BoolOpOr NameLoad NameLoad body Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad orelse If NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad TupleLoad Call AttributeLoad NameLoad attr Str Str Str AugAssignAdd NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad Assign NameStore NameLoad For NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If BoolOpOr NameLoad CompareEq NameLoad Call NameLoad AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad TupleLoad Call AttributeLoad NameLoad attr Str NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Continue AugAssignAdd NameStore NameLoad AugAssignAdd NameStore NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str body Expr Str If UnaryOpNot NameLoad body Return Assign NameStore Num For NameStore NameLoad body Assign NameStore NameLoad Assign NameStore Num Assign TupleStore NameStore NameStore NameStore NameLoad Assign NameStore NameLoad While NameLoad body Assign NameStore NameStore NameStore NameStore NameStore NameLoad AugAssignAdd NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr keyword Str TryExcept body Assign NameStore AttributeLoad SubscriptLoad NameLoad Index Num attr handlers ExceptHandler type NameLoad body Assign NameStore NameLoad TryExcept body Assign NameStore BinOpSub Call NameLoad NameLoad Num handlers ExceptHandler type NameLoad body Assign NameStore NameLoad TryExcept body Assign NameStore BinOpSub Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body If CompareEq NameLoad Num body Assign NameStore Num orelse Assign NameStore NameLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Str If CompareIn NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore BinOpAdd Call AttributeLoad Str attr TupleLoad NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Str If BoolOpAnd CompareEq NameLoad Num CompareGt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd NameLoad Str NameLoad Assign NameStore Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr AugAssignAdd NameStore Num TryExcept body Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr NameLoad Num body Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Num attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad Call NameLoad Lambda arguments args NameParam defaults CompareEq NameLoad SubscriptLoad NameLoad Index Num NameLoad body If CompareLt Call NameLoad SubscriptLoad NameLoad Index Num Num body Return Call NameLoad SubscriptLoad NameLoad Index Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr orelse If Call NameLoad ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list decorator_list
N/A N/A datetime N/A itertools N/A logging N/A os N/A sys django.conf settings worldcat.request.search SRURequest worldcat.util.extract extract_elements N/A _logger N/A N/A logging getLogger __name__ N/A WSKEY N/A settings WORLDCAT_KEY N/A sortkeys Date,,0 N/A recordschema info:srw/schema/1/marcxml N/A recordpacking xml N/A servicelevel full N/A frbrgrouping off N/A MAX_RECORDS 50 N/A raw_query srw.pc any "y" and srw.mt any "newspaper" N/A COUNTRIES N/A united states puerto rico virgin island* guam *northern mariana* american samoa texas N/A OPERATOR_MAP N/A = <= >= > < e lte gte gt lt str_value N/A N/A value N/A N/A N/A 
    Turn the value into at least a 4 digit string.
    This is used in the naming of files.
     N/A str_value N/A str value N/A N/A N/A len str_value 4 N/A N/A str_value N/A 0 str_value N/A str_value N/A TitlePuller N/A object N/A N/A 
    Title puller class pulls files from OCLC's Worldcat API,
    based on params passed.

    Best place to start is with the run method. Run defaults to
    a generic pull for Chronam, unless a query is passed.
     N/A year_breaks N/A generate_year_dict N/A N/A self start end N/A None None N/A N/A 
        Generate a list of years to break up the query. OCLC API queries
        between 1000 and 2030 if not defined. Our main use case is after 1800.
        Since we break up our requests by year, we are starting
        with 1800 as default and using the current year as the end.

        The final requests will pull records before 1800, but will be package
        them with 1800, because we will grab < 1800.

        OCLC indexes unknown values with zeros. So, uuuu will be indexed
        as 0000 & 1uuu will be indexed as 1000. For that reason,
        we explicitly add 0000 & 1000 to the list of years to query.

        Finally, this function will except a start & an end value. If
        a start or end value is passed then the special cases 0000 & 1000
        are ignored. This is so the user has control & extra records are
        not added. It should be noted that a date such as 19uu will be
        indexed as 1900 & 195u will be indexed as 1950.
         N/A year_and_action N/A N/A N/A N/A start N/A end N/A N/A special_yr_cases N/A 0000 1000 N/A N/A special_yr_cases N/A N/A start N/A N/A N/A year_and_action N/A N/A str start = N/A N/A start 1800 N/A N/A year_and_action N/A N/A str start <= N/A end N/A N/A N/A year_and_action N/A N/A str end = N/A N/A now N/A N/A N/A datetime datetime now N/A end N/A now year N/A N/A year_and_action N/A N/A str end >= N/A year N/A N/A range N/A start 1 end special_yr_cases N/A N/A N/A year_and_action N/A N/A str year = N/A year_and_action N/A add_to_query N/A N/A self oclc_field value relationship query N/A None N/A N/A 
        Add additional values to the base query
        For example, this:
        self.add_to_query(query, 'srw.la', 'spa', 'exact')

        Will add this to the query you pass:
        'srw.la exact "spa"'
        and if there is a query value, then...
        query + 'and srw.la exact "spa"'

        More info on indexes to query:
        http://oclc.org/developer/documentation/worldcat-search-api/complete-list-indexes
         N/A new_query N/A %s %s "%s" N/A oclc_field relationship value N/A query N/A N/A new_query N/A %s and %s N/A query new_query N/A new_query N/A generate_srurequest N/A N/A self query N/A N/A N/A 
        Generates the SRURequest used to query OCLC API.
        Most of the values are static, except for query.
         N/A bib_rec N/A SRURequest wskey WSKEY sortKeys sortkeys recordSchema recordschema recordPacking recordpacking servicelevel servicelevel query query startRecord 1 maximumRecords MAX_RECORDS frbrGrouping frbrgrouping N/A bib_rec N/A generate_requests N/A N/A self lccn oclc raw_query countries start end totals_only N/A None None raw_query COUNTRIES None None False N/A N/A 
        Generate request(s) is a function that generates a set of requests
        to be executed against the OCLC API. A set of requests can be
        just one request, example an lccn, or it can be a larger title pull.
         N/A bibs_to_req N/A N/A N/A lccn oclc N/A N/A lccn N/A N/A query N/A N/A self add_to_query srw.dn lccn exact N/A N/A oclc N/A N/A query N/A N/A self add_to_query srw.no oclc exact N/A request N/A N/A self generate_srurequest query N/A lccn_count N/A N/A self initial_total_count request N/A N/A N/A bibs_to_req append N/A request N/A lccn_count N/A 0 N/A lccn N/A N/A grand_total 0 N/A country countries N/A N/A total 0 N/A query N/A N/A self add_to_query srw.cp country exact raw_query N/A N/A start end N/A N/A request_able None N/A N/A cntry_req N/A N/A self generate_srurequest query N/A cntry_count N/A N/A self initial_total_count cntry_req N/A request_able N/A N/A self check_for_doable_bulk_request cntry_count N/A N/A N/A _logger info N/A %s request totals: %s N/A N/A N/A country title cntry_count N/A N/A request_able 0 N/A N/A N/A N/A _logger warning N/A No records returned for: %s country N/A N/A request_able N/A N/A N/A N/A bibs_to_req append N/A cntry_req request_able N/A N/A N/A country strip * all-yrs = N/A total request_able N/A N/A year_dict N/A N/A self generate_year_dict start start end end N/A base_query query N/A year N/A sorted N/A N/A year_dict iterkeys N/A N/A operator N/A year_dict N/A year N/A query N/A N/A self add_to_query srw.yr year operator base_query N/A yr_request N/A N/A self generate_srurequest query N/A yr_count N/A N/A self initial_total_count yr_request N/A yr_request_able N/A N/A self check_for_doable_bulk_request yr_count N/A N/A N/A _logger info N/A %s - %s %s total: %s N/A N/A N/A country title year operator yr_request_able N/A N/A yr_request_able N/A year N/A str N/A N/A N/A N/A datetime datetime now year N/A N/A N/A N/A bibs_to_req append N/A yr_request yr_request_able N/A N/A N/A country strip * year operator N/A N/A N/A N/A _logger warning There is a problem with request. Exiting. N/A N/A N/A _logger warning N/A yr_request: %s yr_request N/A N/A N/A _logger warning N/A yr_request_able: %s yr_request_able N/A N/A N/A _logger warning N/A country: %s N/A N/A country strip * N/A N/A N/A _logger warning N/A year: %s year N/A N/A N/A _logger warning N/A operator: %s operator N/A N/A total yr_request_able N/A grand_total total N/A N/A N/A _logger info N/A GRAND TOTAL: %s grand_total N/A bibs_to_req N/A grab_content N/A N/A self save_path bib_requests search_name N/A ndnp N/A N/A 
        Loops over all requests, executes request & saves response
        to the designated 'save_path'.
         N/A N/A bib_requests N/A N/A N/A files_saved 0 N/A bib_rec bib_requests N/A N/A grab_records True N/A counter 0 N/A N/A bib_request total components bib_rec N/A previous_next None N/A grab_records N/A N/A bib_resp next_record next end start None N/A counter 1 N/A bib_resp N/A N/A bib_request get_response N/A next_record N/A extract_elements N/A bib_request response element {http://www.loc.gov/zing/srw/}nextRecordPosition N/A N/A N/A next N/A N/A next_record N/A 0 text N/A N/A N/A IndexError N/A N/A grab_records False N/A N/A N/A end N/A N/A int next 1 N/A N/A N/A TypeError N/A N/A end total N/A N/A N/A start N/A N/A int next MAX_RECORDS N/A N/A N/A TypeError N/A N/A N/A counter 1 N/A N/A start 1 N/A N/A start previous_next N/A N/A start None N/A N/A grab_records False N/A name_components N/A N/A i components N/A N/A i N/A N/A i replace - N/A N/A i OPERATOR_MAP N/A N/A i N/A OPERATOR_MAP N/A i N/A N/A N/A name_components append i N/A batch_name N/A N/A _ join name_components N/A filename N/A N/A N/A _ join N/A search_name batch_name N/A str_value start N/A str_value end .xml N/A N/A N/A counter 1 N/A N/A len bib_requests 1 N/A N/A N/A N/A _logger info N/A Batch: %s = %s total N/A filename total N/A file_location N/A N/A save_path / filename N/A save_file N/A open file_location w N/A decoded_data N/A N/A N/A bib_resp data decode utf-8 N/A N/A N/A save_file write N/A N/A decoded_data encode ascii xmlcharrefreplace N/A N/A N/A save_file close N/A files_saved 1 N/A N/A N/A previous_next next N/A N/A N/A bib_request next N/A N/A N/A StopIteration N/A N/A grab_records False N/A files_saved N/A initial_total_count N/A N/A self bib_req N/A N/A N/A 
        This function hits request three times and returns list of totals from
        each hit. This is used to access the quality of results returned.
         N/A totals N/A N/A grab N/A N/A itertools repeat None 3 N/A N/A N/A N/A bib_req get_response N/A _total N/A extract_elements N/A bib_req response element {http://www.loc.gov/zing/srw/}numberOfRecords N/A N/A N/A totals append N/A N/A _total N/A 0 text N/A totals N/A check_for_doable_bulk_request N/A N/A self test_totals N/A N/A N/A 
        This function compares the results returned from the 3 requests
        passed in test_totals. The API could misfire when requesting
        more than 10k, so we make sure that are requests aren't that large.
         N/A N/A all N/A map N/A N/A N/A x N/A N/A x N/A test_totals N/A 0 test_totals N/A N/A N/A N/A int N/A test_totals N/A 0 10000 N/A N/A N/A int N/A test_totals N/A 0 N/A None N/A run N/A N/A self save_path lccn oclc start end countries N/A None None None None COUNTRIES N/A N/A 
        Function that runs a search against the WorldCat Search API

        The default query is:
        for country in COUNTRIES:
            'srw.pc any "y" and srw.mt any "newspaper"' + country

        If you pass a string as the query, then it will over ride
        and pull for that query.
        Response is stored in data if no argument is passed.
         N/A N/A N/A N/A N/A os path exists save_path N/A N/A N/A N/A N/A N/A os makedirs save_path N/A N/A N/A OSError N/A N/A N/A N/A _logger exception N/A Issue creating the directory %s. save_path N/A N/A N/A sys exit N/A N/A N/A len N/A f N/A f N/A N/A os listdir save_path N/A N/A N/A os path isfile f N/A N/A N/A N/A _logger exception N/A Destination directory %s is not empty. save_path N/A N/A N/A sys exit N/A files_saved 0 N/A bib_requests N/A N/A self generate_requests lccn lccn oclc oclc start start end end countries countries N/A files_saved N/A N/A self grab_content save_path bib_requests N/A files_saved N/A N/A