python-documentcloud 4.4.0__tar.gz → 4.4.1__tar.gz
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.
- {python_documentcloud-4.4.0/python_documentcloud.egg-info → python_documentcloud-4.4.1}/PKG-INFO +3 -2
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/client.py +8 -4
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/documents.py +13 -7
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1/python_documentcloud.egg-info}/PKG-INFO +3 -2
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/setup.py +1 -1
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_documents.py +4 -1
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/LICENSE +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/README.md +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/__init__.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/addon.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/annotations.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/base.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/constants.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/exceptions.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/organizations.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/projects.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/sections.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/toolbox.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/documentcloud/users.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/SOURCES.txt +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/dependency_links.txt +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/requires.txt +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/top_level.txt +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/setup.cfg +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_annotations.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_base.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_client.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_organizations.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_projects.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_sections.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_toolbox.py +0 -0
- {python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/tests/test_users.py +0 -0
{python_documentcloud-4.4.0/python_documentcloud.egg-info → python_documentcloud-4.4.1}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-documentcloud
|
|
3
|
-
Version: 4.4.
|
|
3
|
+
Version: 4.4.1
|
|
4
4
|
Summary: A simple Python wrapper for the DocumentCloud API
|
|
5
5
|
Home-page: https://github.com/muckrock/python-documentcloud
|
|
6
6
|
Author: Mitchell Kotler
|
|
@@ -46,6 +46,7 @@ Dynamic: description
|
|
|
46
46
|
Dynamic: description-content-type
|
|
47
47
|
Dynamic: home-page
|
|
48
48
|
Dynamic: license
|
|
49
|
+
Dynamic: license-file
|
|
49
50
|
Dynamic: provides-extra
|
|
50
51
|
Dynamic: requires-dist
|
|
51
52
|
Dynamic: summary
|
|
@@ -14,12 +14,11 @@ from .users import UserClient
|
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger("documentcloud")
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
class DocumentCloud(SquareletClient):
|
|
19
18
|
"""
|
|
20
19
|
The public interface for the DocumentCloud API, now integrated with SquareletClient
|
|
21
20
|
"""
|
|
22
|
-
|
|
21
|
+
# pylint:disable=too-many-positional-arguments
|
|
23
22
|
def __init__(
|
|
24
23
|
self,
|
|
25
24
|
username=None,
|
|
@@ -31,7 +30,7 @@ class DocumentCloud(SquareletClient):
|
|
|
31
30
|
rate_limit=True,
|
|
32
31
|
rate_limit_sleep=True,
|
|
33
32
|
):
|
|
34
|
-
|
|
33
|
+
# Initialize SquareletClient for authentication and request handling
|
|
35
34
|
super().__init__(
|
|
36
35
|
base_uri=base_uri,
|
|
37
36
|
username=username,
|
|
@@ -39,7 +38,7 @@ class DocumentCloud(SquareletClient):
|
|
|
39
38
|
auth_uri=auth_uri,
|
|
40
39
|
timeout=timeout,
|
|
41
40
|
rate_limit=rate_limit,
|
|
42
|
-
rate_limit_sleep=rate_limit_sleep
|
|
41
|
+
rate_limit_sleep=rate_limit_sleep
|
|
43
42
|
)
|
|
44
43
|
|
|
45
44
|
# Set up logging
|
|
@@ -56,3 +55,8 @@ class DocumentCloud(SquareletClient):
|
|
|
56
55
|
self.projects = ProjectClient(self)
|
|
57
56
|
self.users = UserClient(self)
|
|
58
57
|
self.organizations = OrganizationClient(self)
|
|
58
|
+
|
|
59
|
+
"""def _request(self, method, url, raise_error=True, **kwargs):
|
|
60
|
+
Delegates request to the SquareletClient's _request method
|
|
61
|
+
return self.squarelet_client.request(method, url, raise_error, **kwargs)
|
|
62
|
+
"""
|
|
@@ -74,7 +74,7 @@ class Document(BaseAPIObject):
|
|
|
74
74
|
def __getattr__(self, attr):
|
|
75
75
|
"""Generate methods for fetching resources"""
|
|
76
76
|
p_image = re.compile(
|
|
77
|
-
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
|
|
77
|
+
r"^get_(?P<size>thumbnail|small|normal|large|xlarge)_image_url(?P<list>_list)?$"
|
|
78
78
|
)
|
|
79
79
|
get = attr.startswith("get_")
|
|
80
80
|
url = attr.endswith("_url")
|
|
@@ -404,7 +404,9 @@ class DocumentClient(BaseAPIClient):
|
|
|
404
404
|
path_list = self._collect_files(path, extensions)
|
|
405
405
|
|
|
406
406
|
logger.info(
|
|
407
|
-
"Upload directory on %s: Found %d files to upload",
|
|
407
|
+
"Upload directory on %s: Found %d files to upload",
|
|
408
|
+
path,
|
|
409
|
+
len(path_list)
|
|
408
410
|
)
|
|
409
411
|
|
|
410
412
|
# Upload all the files using the bulk API to reduce the number
|
|
@@ -442,7 +444,7 @@ class DocumentClient(BaseAPIClient):
|
|
|
442
444
|
logger.info(
|
|
443
445
|
"Error creating the following documents: %s\n%s",
|
|
444
446
|
exc,
|
|
445
|
-
"\n".join(file_paths)
|
|
447
|
+
"\n".join(file_paths)
|
|
446
448
|
)
|
|
447
449
|
continue
|
|
448
450
|
else:
|
|
@@ -463,7 +465,7 @@ class DocumentClient(BaseAPIClient):
|
|
|
463
465
|
logger.info(
|
|
464
466
|
"Error uploading the following document: %s %s",
|
|
465
467
|
exc,
|
|
466
|
-
file_path
|
|
468
|
+
file_path
|
|
467
469
|
)
|
|
468
470
|
continue
|
|
469
471
|
else:
|
|
@@ -479,7 +481,7 @@ class DocumentClient(BaseAPIClient):
|
|
|
479
481
|
logger.info(
|
|
480
482
|
"Error creating the following documents: %s\n%s",
|
|
481
483
|
exc,
|
|
482
|
-
"\n".join(file_paths)
|
|
484
|
+
"\n".join(file_paths)
|
|
483
485
|
)
|
|
484
486
|
continue
|
|
485
487
|
else:
|
|
@@ -502,7 +504,11 @@ class DocumentClient(BaseAPIClient):
|
|
|
502
504
|
# Grouper will put None's on the end of the last group
|
|
503
505
|
url_group = [url for url in url_group if url is not None]
|
|
504
506
|
|
|
505
|
-
logger.info(
|
|
507
|
+
logger.info(
|
|
508
|
+
"Uploading group %d: %s",
|
|
509
|
+
i + 1,
|
|
510
|
+
"\n".join(url_group)
|
|
511
|
+
)
|
|
506
512
|
|
|
507
513
|
# Create the documents
|
|
508
514
|
logger.info("Creating the documents...")
|
|
@@ -525,7 +531,7 @@ class DocumentClient(BaseAPIClient):
|
|
|
525
531
|
logger.info(
|
|
526
532
|
"Error creating the following documents: %s\n%s",
|
|
527
533
|
str(exc),
|
|
528
|
-
"\n".join(url_group)
|
|
534
|
+
"\n".join(url_group)
|
|
529
535
|
)
|
|
530
536
|
continue
|
|
531
537
|
else:
|
{python_documentcloud-4.4.0 → python_documentcloud-4.4.1/python_documentcloud.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-documentcloud
|
|
3
|
-
Version: 4.4.
|
|
3
|
+
Version: 4.4.1
|
|
4
4
|
Summary: A simple Python wrapper for the DocumentCloud API
|
|
5
5
|
Home-page: https://github.com/muckrock/python-documentcloud
|
|
6
6
|
Author: Mitchell Kotler
|
|
@@ -46,6 +46,7 @@ Dynamic: description
|
|
|
46
46
|
Dynamic: description-content-type
|
|
47
47
|
Dynamic: home-page
|
|
48
48
|
Dynamic: license
|
|
49
|
+
Dynamic: license-file
|
|
49
50
|
Dynamic: provides-extra
|
|
50
51
|
Dynamic: requires-dist
|
|
51
52
|
Dynamic: summary
|
|
@@ -158,7 +158,9 @@ class TestDocument:
|
|
|
158
158
|
|
|
159
159
|
class TestDocumentClient:
|
|
160
160
|
def test_search(self, client, document):
|
|
161
|
-
documents = client.documents.search(
|
|
161
|
+
documents = client.documents.search(
|
|
162
|
+
f"document:{document.id} simple"
|
|
163
|
+
)
|
|
162
164
|
assert documents
|
|
163
165
|
|
|
164
166
|
def test_list(self, client):
|
|
@@ -180,6 +182,7 @@ class TestDocumentClient:
|
|
|
180
182
|
document = document_factory(pdf)
|
|
181
183
|
assert document.status == "success"
|
|
182
184
|
|
|
185
|
+
|
|
183
186
|
def test_upload_file_path(self, document_factory):
|
|
184
187
|
document = document_factory("tests/test.pdf")
|
|
185
188
|
assert document.status == "success"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_documentcloud-4.4.0 → python_documentcloud-4.4.1}/python_documentcloud.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|