bookops_worldcat.utils
Shared utilities module.
prep_oclc_number_str
prep_oclc_number_str(oclcNumber: str) -> str
Checks for OCLC prefixes and removes them.
PARAMETER | DESCRIPTION |
---|---|
oclcNumber |
OCLC record number as string
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
|
RAISES | DESCRIPTION |
---|---|
InvalidOclcNumber
|
If |
Source code in bookops_worldcat/utils.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
verify_ids
verify_ids(
ids: Union[str, int, list[str], list[int], None]
) -> Union[str, None]
Parses list of registry IDs or OCLC symbols. IDs will be joined and returned as a comma-separated string if more than one id is passed.
PARAMETER | DESCRIPTION |
---|---|
ids |
one or more institution registry ID(s) or OCLC symbol(s) EXAMPLES:
|
RETURNS | DESCRIPTION |
---|---|
Union[str, None]
|
ids as a string or None |
Source code in bookops_worldcat/utils.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
verify_oclc_number
verify_oclc_number(oclcNumber: Union[int, str]) -> str
Verifies a valid looking OCLC number is passed and normalize it as integer.
PARAMETER | DESCRIPTION |
---|---|
oclcNumber |
OCLC record number as string or integer |
RETURNS | DESCRIPTION |
---|---|
str
|
|
RAISES | DESCRIPTION |
---|---|
InvalidOclcNumber
|
If |
Source code in bookops_worldcat/utils.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
verify_oclc_numbers
verify_oclc_numbers(
oclcNumbers: Union[int, str, list[Union[str, int]]]
) -> list[str]
Parses and verifies list of oclcNumbers
PARAMETER | DESCRIPTION |
---|---|
oclcNumbers |
List of OCLC control numbers. Control numbers can be integers or strings with or without OCLC # prefix. If str, the numbers must be separated by commas. If int, only one number will be parsed. Lists may contain strings or integers or a combination of both. |
RETURNS | DESCRIPTION |
---|---|
list[str]
|
|
RAISES | DESCRIPTION |
---|---|
InvalidOclcNumber
|
If |
Source code in bookops_worldcat/utils.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|