pyzotero 1.7.6__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyzotero/__init__.py +60 -0
- pyzotero/_client.py +1402 -0
- pyzotero/_decorators.py +195 -0
- pyzotero/_search.py +190 -0
- pyzotero/_upload.py +241 -0
- pyzotero/_utils.py +86 -0
- pyzotero/cli.py +420 -1
- pyzotero/errors.py +185 -0
- pyzotero/filetransport.py +2 -2
- pyzotero/semantic_scholar.py +441 -0
- pyzotero/zotero.py +62 -2035
- pyzotero/zotero_errors.py +53 -136
- {pyzotero-1.7.6.dist-info → pyzotero-1.8.0.dist-info}/METADATA +3 -3
- pyzotero-1.8.0.dist-info/RECORD +16 -0
- pyzotero-1.7.6.dist-info/RECORD +0 -9
- {pyzotero-1.7.6.dist-info → pyzotero-1.8.0.dist-info}/WHEEL +0 -0
- {pyzotero-1.7.6.dist-info → pyzotero-1.8.0.dist-info}/entry_points.txt +0 -0
pyzotero/zotero_errors.py
CHANGED
|
@@ -1,141 +1,58 @@
|
|
|
1
|
-
"""
|
|
2
|
-
zotero_errors.py
|
|
3
|
-
|
|
4
|
-
Created by Stephan Hügel on 2011-03-04
|
|
5
|
-
|
|
6
|
-
This file is part of Pyzotero.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Define some exceptions
|
|
11
|
-
class PyZoteroError(Exception):
|
|
12
|
-
"""Generic parent exception"""
|
|
13
|
-
|
|
14
|
-
pass
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class ParamNotPassedError(PyZoteroError):
|
|
18
|
-
"""Raised if a parameter which is required isn't passed"""
|
|
19
|
-
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class CallDoesNotExistError(PyZoteroError):
|
|
24
|
-
"""Raised if the specified API call doesn't exist"""
|
|
25
|
-
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class UnsupportedParamsError(PyZoteroError):
|
|
30
|
-
"""Raised when unsupported parameters are passed"""
|
|
31
|
-
|
|
32
|
-
pass
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class UserNotAuthorisedError(PyZoteroError):
|
|
36
|
-
"""Raised when the user is not allowed to retrieve the resource"""
|
|
37
|
-
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class TooManyItemsError(PyZoteroError):
|
|
42
|
-
"""Raised when too many items are passed to a Write API method"""
|
|
43
|
-
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class MissingCredentialsError(PyZoteroError):
|
|
48
|
-
"""
|
|
49
|
-
Raised when an attempt is made to create a Zotero instance
|
|
50
|
-
without providing both the user ID and the user key
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
pass
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class InvalidItemFieldsError(PyZoteroError):
|
|
57
|
-
"""Raised when an attempt is made to create/update items w/invalid fields"""
|
|
58
|
-
|
|
59
|
-
pass
|
|
60
|
-
|
|
1
|
+
"""Backwards-compatible re-exports for pyzotero.zotero_errors module.
|
|
61
2
|
|
|
62
|
-
|
|
63
|
-
|
|
3
|
+
This module maintains backwards compatibility for code that imports from
|
|
4
|
+
pyzotero.zotero_errors. New code should import from pyzotero.errors.
|
|
64
5
|
|
|
65
|
-
|
|
6
|
+
Example:
|
|
7
|
+
# Old style (still works)
|
|
8
|
+
from pyzotero import zotero_errors as ze
|
|
66
9
|
|
|
10
|
+
# New style (preferred)
|
|
11
|
+
from pyzotero import errors as ze
|
|
67
12
|
|
|
68
|
-
|
|
69
|
-
"""Raised for miscellaneous URLLib errors"""
|
|
70
|
-
|
|
71
|
-
pass
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class CouldNotReachURLError(PyZoteroError):
|
|
75
|
-
"""Raised when we can't reach a URL"""
|
|
76
|
-
|
|
77
|
-
pass
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class ConflictError(PyZoteroError):
|
|
81
|
-
"""409 - Raised when the target library is locked"""
|
|
82
|
-
|
|
83
|
-
pass
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class PreConditionFailedError(PyZoteroError):
|
|
87
|
-
"""
|
|
88
|
-
412 - Raised when the provided X-Zotero-Write-Token has already been
|
|
89
|
-
submitted
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
pass
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class RequestEntityTooLargeError(PyZoteroError):
|
|
96
|
-
"""
|
|
97
|
-
413 - The upload would exceed the storage quota of the library owner.
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
pass
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class PreConditionRequiredError(PyZoteroError):
|
|
104
|
-
"""
|
|
105
|
-
428 - Raised when If-Match or If-None-Match was not provided.
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
pass
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class TooManyRequestsError(PyZoteroError):
|
|
112
|
-
"""
|
|
113
|
-
429 - Raised when there are too many unfinished uploads.
|
|
114
|
-
Try again after the number of seconds specified in the Retry-After header.
|
|
115
|
-
"""
|
|
116
|
-
|
|
117
|
-
pass
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
class FileDoesNotExistError(PyZoteroError):
|
|
121
|
-
"""
|
|
122
|
-
Raised when a file path to be attached can't be opened (or doesn't exist)
|
|
123
|
-
"""
|
|
124
|
-
|
|
125
|
-
pass
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
class TooManyRetriesError(PyZoteroError):
|
|
129
|
-
"""
|
|
130
|
-
Raise after the backoff period for new requests exceeds 32s
|
|
131
|
-
"""
|
|
132
|
-
|
|
133
|
-
pass
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
class UploadError(PyZoteroError):
|
|
137
|
-
"""
|
|
138
|
-
Raise if the connection drops during upload or some other non-HTTP error code is returned
|
|
139
|
-
"""
|
|
13
|
+
"""
|
|
140
14
|
|
|
141
|
-
|
|
15
|
+
# Re-export all exceptions for backwards compatibility
|
|
16
|
+
from pyzotero.errors import (
|
|
17
|
+
CallDoesNotExistError,
|
|
18
|
+
ConflictError,
|
|
19
|
+
CouldNotReachURLError,
|
|
20
|
+
FileDoesNotExistError,
|
|
21
|
+
HTTPError,
|
|
22
|
+
InvalidItemFieldsError,
|
|
23
|
+
MissingCredentialsError,
|
|
24
|
+
ParamNotPassedError,
|
|
25
|
+
PreConditionFailedError,
|
|
26
|
+
PreConditionRequiredError,
|
|
27
|
+
PyZoteroError,
|
|
28
|
+
RequestEntityTooLargeError,
|
|
29
|
+
ResourceNotFoundError,
|
|
30
|
+
TooManyItemsError,
|
|
31
|
+
TooManyRequestsError,
|
|
32
|
+
TooManyRetriesError,
|
|
33
|
+
UnsupportedParamsError,
|
|
34
|
+
UploadError,
|
|
35
|
+
UserNotAuthorisedError,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"CallDoesNotExistError",
|
|
40
|
+
"ConflictError",
|
|
41
|
+
"CouldNotReachURLError",
|
|
42
|
+
"FileDoesNotExistError",
|
|
43
|
+
"HTTPError",
|
|
44
|
+
"InvalidItemFieldsError",
|
|
45
|
+
"MissingCredentialsError",
|
|
46
|
+
"ParamNotPassedError",
|
|
47
|
+
"PreConditionFailedError",
|
|
48
|
+
"PreConditionRequiredError",
|
|
49
|
+
"PyZoteroError",
|
|
50
|
+
"RequestEntityTooLargeError",
|
|
51
|
+
"ResourceNotFoundError",
|
|
52
|
+
"TooManyItemsError",
|
|
53
|
+
"TooManyRequestsError",
|
|
54
|
+
"TooManyRetriesError",
|
|
55
|
+
"UnsupportedParamsError",
|
|
56
|
+
"UploadError",
|
|
57
|
+
"UserNotAuthorisedError",
|
|
58
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyzotero
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Python wrapper for the Zotero API
|
|
5
5
|
Keywords: Zotero,DH
|
|
6
6
|
Author: Stephan Hügel
|
|
@@ -82,8 +82,8 @@ Description-Content-Type: text/markdown
|
|
|
82
82
|
Then:
|
|
83
83
|
|
|
84
84
|
``` python
|
|
85
|
-
from pyzotero import
|
|
86
|
-
zot =
|
|
85
|
+
from pyzotero import Zotero
|
|
86
|
+
zot = Zotero(library_id, library_type, api_key) # local=True for read access to local Zotero
|
|
87
87
|
items = zot.top(limit=5)
|
|
88
88
|
# we've retrieved the latest five top-level items in our library
|
|
89
89
|
# we can print each item's item type and ID
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pyzotero/__init__.py,sha256=6k_iURpZr-9PfOr9UAs_XQLJB59yoJwTd6EKe-DNYbE,1663
|
|
2
|
+
pyzotero/_client.py,sha256=edxtbyjDP6x_IBtSpc-Dhxa3wFNdeZGOq7-TTj26_Uo,51644
|
|
3
|
+
pyzotero/_decorators.py,sha256=nMx3bBM8UFp5cS-c1vcm-toJ2CSDXM78coh-beWqHbA,6343
|
|
4
|
+
pyzotero/_search.py,sha256=LNFbouGZ2rBF2LblFnL39998ZGXYQeqSsMArAgkhBtI,7259
|
|
5
|
+
pyzotero/_upload.py,sha256=_Q3Ex7EGf6GFaxaT_Rv2UG3u9rrCJE4H-tmQUYGOr7M,9052
|
|
6
|
+
pyzotero/_utils.py,sha256=c8L0WXzv0_SqDd-Pio4MCCyydq_fdhGX4UXYGNf92hA,2382
|
|
7
|
+
pyzotero/cli.py,sha256=q1qo6VH_WmCmuSQFSjqa7PRhhUEwecb_hHT0oPsXRAI,28674
|
|
8
|
+
pyzotero/errors.py,sha256=To9IkdcA5zGkR3Rl88kAIktGBXhrMimfZdNxkqHNZLY,5211
|
|
9
|
+
pyzotero/filetransport.py,sha256=HFXfRP8haG31JIA-CmEcKE3oTzqNN04Pjn7u8KwE7u0,5498
|
|
10
|
+
pyzotero/semantic_scholar.py,sha256=2_a6UyUYVBFPQKS8JgBylGksM90aVtq4V3HtpbF1OTI,12728
|
|
11
|
+
pyzotero/zotero.py,sha256=8oOSlCZ4fOCVLZBbM07-oCCouI43m_bTG7oAEqAHzuM,1591
|
|
12
|
+
pyzotero/zotero_errors.py,sha256=9EVkGS73SJy5VuKBGtxtQtxFqz1y-jQgYyrx9aBICvw,1475
|
|
13
|
+
pyzotero-1.8.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
14
|
+
pyzotero-1.8.0.dist-info/entry_points.txt,sha256=MzN7IMRj_oPNmDCsseYFPum3bHWE1gFxywhlbFbcn2k,48
|
|
15
|
+
pyzotero-1.8.0.dist-info/METADATA,sha256=OUkZcCjw-3nQ6mzYWsN_5gHWr-dNBzSYi007h3xz4Hk,9956
|
|
16
|
+
pyzotero-1.8.0.dist-info/RECORD,,
|
pyzotero-1.7.6.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
2
|
-
pyzotero/cli.py,sha256=dsq4QFqs4vig7CpORQYWD96smM8Z00BbaVh8AsLjhmg,16243
|
|
3
|
-
pyzotero/filetransport.py,sha256=umLik1LLmrpgaNmyjvtBoqqcaMgIq79PYsTvN5vG-gY,5530
|
|
4
|
-
pyzotero/zotero.py,sha256=nUgch-YvNHiQb8qR7Pz9ntgNJv76XDcvINvCs56vvFc,76877
|
|
5
|
-
pyzotero/zotero_errors.py,sha256=6obx9-pBO0z1bxt33vuzDluELvA5kSLCsfc-uGc3KNw,2660
|
|
6
|
-
pyzotero-1.7.6.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
7
|
-
pyzotero-1.7.6.dist-info/entry_points.txt,sha256=MzN7IMRj_oPNmDCsseYFPum3bHWE1gFxywhlbFbcn2k,48
|
|
8
|
-
pyzotero-1.7.6.dist-info/METADATA,sha256=oPlV0BYolZ8TXTWJjtnChKeA4Rxcf1rx2crVENVlRhY,9962
|
|
9
|
-
pyzotero-1.7.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|