python-documentcloud 4.5.0__py2.py3-none-any.whl → 4.6.0__py2.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.
- documentcloud/addon.py +20 -0
- documentcloud/documents.py +1 -5
- documentcloud/exceptions.py +9 -6
- {python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/METADATA +1 -1
- {python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/RECORD +8 -8
- {python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/WHEEL +1 -1
- {python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/licenses/LICENSE +0 -0
- {python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/top_level.txt +0 -0
documentcloud/addon.py
CHANGED
|
@@ -182,6 +182,26 @@ class AddOn(BaseAddOn):
|
|
|
182
182
|
f"addon_runs/{self.id}/", json={"file_name": file_name}
|
|
183
183
|
)
|
|
184
184
|
|
|
185
|
+
def load_run_data(self):
|
|
186
|
+
"Load persistent data from this run"
|
|
187
|
+
if not self.id:
|
|
188
|
+
return {}
|
|
189
|
+
|
|
190
|
+
response = self.client.get(f"addon_runs/{self.id}/")
|
|
191
|
+
response.raise_for_status()
|
|
192
|
+
return response.json().get("data", {})
|
|
193
|
+
|
|
194
|
+
def store_run_data(self, data):
|
|
195
|
+
"Store persistent data for this run"
|
|
196
|
+
if not self.id:
|
|
197
|
+
print("Run ID not set. Try again later or check if something went wrong.")
|
|
198
|
+
return None
|
|
199
|
+
|
|
200
|
+
if not isinstance(data, dict):
|
|
201
|
+
raise TypeError("Invalid data")
|
|
202
|
+
|
|
203
|
+
return self.client.patch(f"addon_runs/{self.id}/", json={"data": data})
|
|
204
|
+
|
|
185
205
|
def load_event_data(self):
|
|
186
206
|
"""Load persistent data for this event"""
|
|
187
207
|
if not self.event_id:
|
documentcloud/documents.py
CHANGED
|
@@ -9,6 +9,7 @@ import os
|
|
|
9
9
|
import re
|
|
10
10
|
import warnings
|
|
11
11
|
from functools import partial
|
|
12
|
+
from urllib.parse import urlparse
|
|
12
13
|
|
|
13
14
|
# Third Party
|
|
14
15
|
from requests.exceptions import RequestException
|
|
@@ -23,11 +24,6 @@ from .sections import SectionClient
|
|
|
23
24
|
from .toolbox import grouper, is_url, merge_dicts, requests_retry_session
|
|
24
25
|
from .users import User
|
|
25
26
|
|
|
26
|
-
try:
|
|
27
|
-
from urllib.parse import urlparse
|
|
28
|
-
except ImportError:
|
|
29
|
-
from urlparse import urlparse
|
|
30
|
-
|
|
31
27
|
logger = logging.getLogger("documentcloud")
|
|
32
28
|
|
|
33
29
|
IMAGE_SIZES = ["thumbnail", "small", "normal", "large", "xlarge"]
|
documentcloud/exceptions.py
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Custom exceptions for python-documentcloud
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
# Third Party
|
|
5
6
|
# pylint: disable=unused-import
|
|
6
7
|
# Import exceptions from python-squarelet
|
|
7
|
-
from squarelet.exceptions import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
from squarelet.exceptions import (
|
|
9
|
+
APIError,
|
|
10
|
+
CredentialsFailedError,
|
|
11
|
+
DoesNotExistError,
|
|
12
|
+
DuplicateObjectError,
|
|
13
|
+
MultipleObjectsReturnedError,
|
|
14
|
+
SquareletError as DocumentCloudError,
|
|
15
|
+
)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
documentcloud/__init__.py,sha256=XAwOR6JYL-flQV_uC616AMA2rYiXTkeogNolqE6LzN4,220
|
|
2
|
-
documentcloud/addon.py,sha256=
|
|
2
|
+
documentcloud/addon.py,sha256=BvELxbc5pm7vYxo8bWY1VLLcn-VJAQQwmy8Y-G7n26c,12402
|
|
3
3
|
documentcloud/annotations.py,sha256=wVe3wYzyTRvc_hJ3r0m6iyDf6WIFlaGcCnyah_r53pg,2538
|
|
4
4
|
documentcloud/base.py,sha256=pNF45aleYpQ9fj75CiL3c4Ssv6MO1EmdzZ6wBLPKHDg,6545
|
|
5
5
|
documentcloud/client.py,sha256=WXHNE1BT-LE2E55XlOvPuWl_g5N0zUIdXvB7Qj_fMNc,1658
|
|
6
6
|
documentcloud/constants.py,sha256=h6NStSkxPrjQ2gzaIlqftCF7tthkRimddOE8SsmlHag,1828
|
|
7
|
-
documentcloud/documents.py,sha256=
|
|
8
|
-
documentcloud/exceptions.py,sha256=
|
|
7
|
+
documentcloud/documents.py,sha256=TlW5fYNEBJQEONVzdVLQTwaoPZaBTBIBRLvrHMevQAA,18230
|
|
8
|
+
documentcloud/exceptions.py,sha256=Fq_v7QBcvj-l4yeT7ii_1MrGAPiRs8e1Fwz8qtB4Xqc,344
|
|
9
9
|
documentcloud/organizations.py,sha256=_Ot6MWzoa5JdU3jqedU-0Fec_K8WrgxqdlIp4oIijes,392
|
|
10
10
|
documentcloud/projects.py,sha256=KuOiw65a-8fdgbjo7BqjbEbWguds8inkhFJZJd578bs,5328
|
|
11
11
|
documentcloud/sections.py,sha256=cMf973KMvp6fAPSMXCD67L32Pz1_Tfh81oV2q2UQ9Uk,924
|
|
12
12
|
documentcloud/toolbox.py,sha256=zFZTyOn40YZjBpqa1H3qjpR4C3Wu1X2g72AvH_ljlic,1835
|
|
13
13
|
documentcloud/users.py,sha256=yydOXoEsfJlYqryZpXQ4G3aeRc5y_QCHqXd0dfF1aIc,354
|
|
14
|
-
python_documentcloud-4.
|
|
15
|
-
python_documentcloud-4.
|
|
16
|
-
python_documentcloud-4.
|
|
17
|
-
python_documentcloud-4.
|
|
18
|
-
python_documentcloud-4.
|
|
14
|
+
python_documentcloud-4.6.0.dist-info/licenses/LICENSE,sha256=Z1IBhHCzIeGR9F2iHtcLt2I2qoUhJ2pK139CAIAuFgo,1151
|
|
15
|
+
python_documentcloud-4.6.0.dist-info/METADATA,sha256=A5tJzw613JXb60SaHESdX0L46ryt31XzWIf6VsEx9sA,2880
|
|
16
|
+
python_documentcloud-4.6.0.dist-info/WHEEL,sha256=TdQ5LtNwLuxTCjgxN51AgdU5w-KkB9ttmLbzjTH02pg,109
|
|
17
|
+
python_documentcloud-4.6.0.dist-info/top_level.txt,sha256=rzNW2vA9GqU5ipNQYSP1XJQ54ippjKXVIo9oMlM0Tm4,14
|
|
18
|
+
python_documentcloud-4.6.0.dist-info/RECORD,,
|
{python_documentcloud-4.5.0.dist-info → python_documentcloud-4.6.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|