Skip to content

Commit 8fece1b

Browse files
Remove versioning specification for documentcloud, since version 2 is default
1 parent 5fdff50 commit 8fece1b

7 files changed

Lines changed: 13 additions & 14 deletions

File tree

dist/python_squarelet-0.1.1.tar.gz

-17.1 KB
Binary file not shown.
18.3 KB
Binary file not shown.

dist/python_squarelet-0.2.0.tar.gz

17 KB
Binary file not shown.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "python-squarelet"
7-
version = "0.1.1"
7+
version = "0.2.0"
88
authors = [
99
{ name="duckduckgrayduck", email="sanjin@muckrock.com" },
1010
]
1111
description = "Python library that handles token authentication for MuckRock and DocumentCloud"
1212
readme = "README.md"
13-
requires-python = ">=3.7,<=3.12"
13+
requires-python = ">=3.8,<=3.12"
1414
classifiers = [
1515
"Programming Language :: Python :: 3",
1616
"License :: OSI Approved :: MIT License",

src/squarelet/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Import core fuctionality
2-
from .squarelet import SquareletClient
1+
""" imports """
32

43
# Import exceptions to handle API errors
54
from squarelet.exceptions import APIError, CredentialsFailedError, DoesNotExistError
65

6+
# Import core fuctionality
7+
from .squarelet import SquareletClient
8+
79
# Constants
810
from .squarelet import BULK_LIMIT, TIMEOUT, RATE_LIMIT, RATE_PERIOD, DEFAULT_AUTH_URI

src/squarelet/squarelet.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ def set_request_kwargs(self, **kwargs):
153153
"headers": kwargs.get("headers", {}),
154154
}
155155

156-
# If the base_uri matches a specific service, add the versioning parameter
157-
if self.base_uri == "https://api.www.documentcloud.org/api/":
158-
custom_kwargs["params"]["version"] = "2.0"
159-
160156
# Allow users to add custom params or headers by passing additional kwargs
161157
# Merge user-provided arguments with the defaults in custom_kwargs
162158
if "params" in kwargs:

src/squarelet/tests.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import os
44
import pytest
5-
from squarelet import (CredentialsFailedError, DoesNotExistError,
6-
SquareletClient)
5+
from squarelet import CredentialsFailedError, DoesNotExistError, SquareletClient
76

8-
#pylint:disable=redefined-outer-name
7+
8+
# pylint:disable=redefined-outer-name
99
@pytest.fixture
1010
def squarelet_client():
1111
"""Fixture to mock a SquareletClient instance."""
@@ -25,27 +25,28 @@ def test_get_tokens(squarelet_client):
2525

2626

2727
def test_get_tokens_invalid_credentials(squarelet_client):
28-
""" Try to authenticate with fake credentials """
28+
"""Try to authenticate with fake credentials"""
2929
# pylint:disable = protected-access
3030
with pytest.raises(CredentialsFailedError):
3131
squarelet_client._get_tokens("invalid_user", "invalid_pass")
3232

3333

3434
def test_raises_for_status(squarelet_client):
35-
""" Assert that other errors are raised """
35+
"""Assert that other errors are raised"""
3636
with pytest.raises(DoesNotExistError) as excinfo:
3737
# This should raise the DoesNotExistError since the status code will be 404
3838
squarelet_client.request("get", "blank")
3939
assert excinfo.value.response.status_code == 404
4040

4141

4242
def test_access_documentcloud(squarelet_client):
43-
""" Test that we can access the DocumentCloud endpoint """
43+
"""Test that we can access the DocumentCloud endpoint"""
4444
sq_user = os.environ.get("SQ_USER")
4545
my_user = squarelet_client.request("get", "users/me/")
4646
user_data = my_user.json()
4747
# We assert here that the username returned by DocumentCloud is our current username
4848
assert user_data["username"] == sq_user
4949

50+
5051
## TO DO def test_access_muckrock():
5152
## TO DO def test_rate_limit(squarelet_client):

0 commit comments

Comments
 (0)