Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Check out code
uses: actions/checkout@v2
Expand Down Expand Up @@ -53,4 +53,4 @@ jobs:

- name: Run pylint and black on ./documentcloud and ./tests
run: |
pylint ./documentcloud ./tests; black ./documentcloud ./tests
pylint ./documentcloud ./tests; black --check ./documentcloud ./tests
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ good-names=i,x1,x2,y1,y2,id

[MESSAGES CONTROL]
disable=missing-docstring,too-many-ancestors,too-few-public-methods,no-else-return,no-member,attribute-defined-outside-init,similarities,import-outside-toplevel,cyclic-import,no-member,no-else-raise,too-many-instance-attributes,too-many-arguments,ungrouped-imports,useless-object-inheritance,no-else-continue

[DESIGN]
max-positional-arguments=10
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
---------

4.4.0
~~~~~
* Removes support for Python 3.7.

4.3.0
~~~~~
* Uses python-squarelet to client handle authentication.
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"index",
"python-documentcloud.tex",
"python-documentcloud Documentation",
"Los Angeles Times Data Desk",
"MuckRock Foundation",
"manual",
),
]
Expand Down Expand Up @@ -241,7 +241,7 @@
"index",
"python-documentcloud",
"python-documentcloud Documentation",
["Los Angeles Times Data Desk"],
["MuckRock Foundation"],
1,
)
]
Expand All @@ -260,7 +260,7 @@
"index",
"python-documentcloud",
"python-documentcloud Documentation",
"Los Angeles Times Data Desk",
"MuckRock Foundation",
"python-documentcloud",
"One line description of project.",
"Miscellaneous",
Expand Down
11 changes: 4 additions & 7 deletions docs/credits.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
Credits
-------

The lead developer of this project is `Ben Welsh <http://palewi.re/who-is-ben-welsh/>`_.

But it would not be possible without:

* `The DocumentCloud team <https://www.documentcloud.org/about>`_.
* `Chris Amico <https://github.com/eyeseast>`_, `Christopher Groskopf <https://github.com/onyxfish/>`_ and `Mitchell Kotler <http://www.muckrock.com/blog/using-the-documentcloud-api/>`_, who broke ground with code that I've adapted.
* Fixes from friendly people like `Joe Germuska <https://github.com/JoeGermuska>`_, `Shane Shifflet <https://twitter.com/#!/shaneshifflett>`_ and `Adi Eyal <https://github.com/adieyal>`_.
This project would not be possible without:

* `The MuckRock technology team <https://www.muckrock.com/staff/>`_,
* `Ben Welsh <https://palewi.re/who-is-ben-welsh />`_,
* Fixes from `Joe Germuska <https://github.com/JoeGermuska>`_, `Shane Shifflet`_,and `Adi Eyal <https://github.com/adieyal>`_.
12 changes: 4 additions & 8 deletions documentcloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

logger = logging.getLogger("documentcloud")


class DocumentCloud(SquareletClient):
"""
The public interface for the DocumentCloud API, now integrated with SquareletClient
"""
# pylint:disable=too-many-positional-arguments

def __init__(
self,
username=None,
Expand All @@ -30,15 +31,15 @@ def __init__(
rate_limit=True,
rate_limit_sleep=True,
):
# Initialize SquareletClient for authentication and request handling
# Initialize SquareletClient for authentication and request handling
super().__init__(
base_uri=base_uri,
username=username,
password=password,
auth_uri=auth_uri,
timeout=timeout,
rate_limit=rate_limit,
rate_limit_sleep=rate_limit_sleep
rate_limit_sleep=rate_limit_sleep,
)

# Set up logging
Expand All @@ -55,8 +56,3 @@ def __init__(
self.projects = ProjectClient(self)
self.users = UserClient(self)
self.organizations = OrganizationClient(self)

"""def _request(self, method, url, raise_error=True, **kwargs):
Delegates request to the SquareletClient's _request method
return self.squarelet_client.request(method, url, raise_error, **kwargs)
"""
18 changes: 6 additions & 12 deletions documentcloud/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
path_list = self._collect_files(path, extensions)

logger.info(
"Upload directory on %s: Found %d files to upload",
path,
len(path_list)
"Upload directory on %s: Found %d files to upload", path, len(path_list)
)

# Upload all the files using the bulk API to reduce the number
Expand Down Expand Up @@ -444,7 +442,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
logger.info(
"Error creating the following documents: %s\n%s",
exc,
"\n".join(file_paths)
"\n".join(file_paths),
)
continue
else:
Expand All @@ -465,7 +463,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
logger.info(
"Error uploading the following document: %s %s",
exc,
file_path
file_path,
)
continue
else:
Expand All @@ -481,7 +479,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
logger.info(
"Error creating the following documents: %s\n%s",
exc,
"\n".join(file_paths)
"\n".join(file_paths),
)
continue
else:
Expand All @@ -504,11 +502,7 @@ def upload_urls(self, url_list, handle_errors=False, **kwargs):
# Grouper will put None's on the end of the last group
url_group = [url for url in url_group if url is not None]

logger.info(
"Uploading group %d: %s",
i + 1,
"\n".join(url_group)
)
logger.info("Uploading group %d: %s", i + 1, "\n".join(url_group))

# Create the documents
logger.info("Creating the documents...")
Expand All @@ -531,7 +525,7 @@ def upload_urls(self, url_list, handle_errors=False, **kwargs):
logger.info(
"Error creating the following documents: %s\n%s",
str(exc),
"\n".join(url_group)
"\n".join(url_group),
)
continue
else:
Expand Down
Loading
Loading