Api
DataciteClient
¶
Source code in ckanext/doi/lib/api.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 84 85 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 111 112 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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
test_mode
property
¶
Whether to run in test mode.
Defaults to true.
Returns:
Type | Description |
---|---|
test mode enabled as boolean (true=enabled) |
check_for_update(doi, xml_dict)
¶
Compare generated xml_dict against the one already posted on datacite.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doi |
the DOI of the package |
required | |
xml_dict |
the xml_dict generated by build_xml_dict |
required |
Returns:
Type | Description |
---|---|
True if the two are the same, False if not |
Source code in ckanext/doi/lib/api.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
generate_doi()
¶
Generate a new DOI which isn't currently in use.
The database is checked for previous usage, as is Datacite itself. Use whatever value is retuned from this function quickly to avoid double use as this function uses no locking.
Returns:
Type | Description |
---|---|
the full, unique DOI |
Source code in ckanext/doi/lib/api.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
get_metadata(doi)
¶
Retrieve metadata for a given DOI on datacite.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doi |
the DOI for which to retrieve the stored metadata |
required |
Returns:
Type | Description |
---|---|
|
Source code in ckanext/doi/lib/api.py
148 149 150 151 152 153 154 155 156 157 158 159 |
|
get_prefix()
classmethod
¶
Get the prefix to use for DOIs.
Returns:
Type | Description |
---|---|
config prefix setting |
Source code in ckanext/doi/lib/api.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
mint_doi(doi, package_id)
¶
Mints the given DOI on datacite. Does not add metadata, just creates the DOI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doi |
the doi (full, prefix and suffix) |
required | |
package_id |
the id of the package this doi is for |
required |
Source code in ckanext/doi/lib/api.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
set_metadata(doi, xml_dict)
¶
Update or create the metadata for a given DOI on datacite.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doi |
the DOI to update the metadata for |
required | |
xml_dict |
the metadata as an xml dict (generated from build_xml_dict) |
required |
Returns:
Type | Description |
---|---|
|
Source code in ckanext/doi/lib/api.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|