Skip to content
Open
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"lxml~=5.1.0",
"marshmallow~=3.23.2",
"openai~=1.60.1",
"pdap-access-manager==0.3.6",
"pdap-access-manager==0.4.2",
"pillow>=11.3.0",
"pip>=25.2",
"playwright~=1.49.1",
Expand Down
9 changes: 8 additions & 1 deletion src/external/pdap/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from src.external.pdap.dtos.match_agency.response import MatchAgencyResponse
from src.external.pdap.dtos.unique_url_duplicate import UniqueURLDuplicateInfo
from src.external.pdap.enums import MatchAgencyResponseStatus
from src.external.pdap.impl.follows.core import get_user_followed_locations
from src.external.pdap.impl.follows.response import GetFollowsResponse
from src.external.pdap.impl.meta_urls.core import submit_meta_urls
from src.external.pdap.impl.meta_urls.request import SubmitMetaURLsRequest

Expand Down Expand Up @@ -156,4 +158,9 @@
return await submit_meta_urls(
self.access_manager,
requests=requests
)
)

async def get_user_followed_locations(self) -> GetFollowsResponse:

Check warning on line 163 in src/external/pdap/client.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/client.py#L163 <102>

Missing docstring in public method
Raw output
./src/external/pdap/client.py:163:1: D102 Missing docstring in public method
return await get_user_followed_locations(
access_manager=self.access_manager
)
Empty file.
20 changes: 20 additions & 0 deletions src/external/pdap/impl/follows/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from pdap_access_manager import AccessManager, DataSourcesNamespaces, RequestInfo, RequestType, ResponseInfo

Check warning on line 1 in src/external/pdap/impl/follows/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/core.py#L1 <100>

Missing docstring in public module
Raw output
./src/external/pdap/impl/follows/core.py:1:1: D100 Missing docstring in public module

Check warning on line 1 in src/external/pdap/impl/follows/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/core.py#L1 <401>

'pdap_access_manager.DataSourcesNamespaces' imported but unused
Raw output
./src/external/pdap/impl/follows/core.py:1:1: F401 'pdap_access_manager.DataSourcesNamespaces' imported but unused

from src.external.pdap.impl.follows.response import GetFollowsResponse, LinkUserFollow

Check warning on line 3 in src/external/pdap/impl/follows/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/core.py#L3 <401>

'src.external.pdap.impl.follows.response.LinkUserFollow' imported but unused
Raw output
./src/external/pdap/impl/follows/core.py:3:1: F401 'src.external.pdap.impl.follows.response.LinkUserFollow' imported but unused


async def get_user_followed_locations(

Check warning on line 6 in src/external/pdap/impl/follows/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/core.py#L6 <103>

Missing docstring in public function
Raw output
./src/external/pdap/impl/follows/core.py:6:1: D103 Missing docstring in public function
access_manager: AccessManager,
) -> GetFollowsResponse:

url: str = f"{access_manager.data_sources_url}/v3/v2/source-collector/follows"
headers: dict[str, str] = await access_manager.jwt_header()
request_info = RequestInfo(
type_=RequestType.GET,
url=url,
headers=headers
)
response_info: ResponseInfo = await access_manager.make_request(request_info)
return GetFollowsResponse(
**response_info.data
)

Check warning on line 20 in src/external/pdap/impl/follows/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/core.py#L20 <292>

no newline at end of file
Raw output
./src/external/pdap/impl/follows/core.py:20:6: W292 no newline at end of file
11 changes: 11 additions & 0 deletions src/external/pdap/impl/follows/response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pydantic import BaseModel

Check warning on line 1 in src/external/pdap/impl/follows/response.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/response.py#L1 <100>

Missing docstring in public module
Raw output
./src/external/pdap/impl/follows/response.py:1:1: D100 Missing docstring in public module


class LinkUserFollow(BaseModel):

Check warning on line 4 in src/external/pdap/impl/follows/response.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/response.py#L4 <101>

Missing docstring in public class
Raw output
./src/external/pdap/impl/follows/response.py:4:1: D101 Missing docstring in public class
user_id: int
location_id: int


class GetFollowsResponse(BaseModel):

Check warning on line 9 in src/external/pdap/impl/follows/response.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/response.py#L9 <101>

Missing docstring in public class
Raw output
./src/external/pdap/impl/follows/response.py:9:1: D101 Missing docstring in public class
follows: list[LinkUserFollow]

Check warning on line 11 in src/external/pdap/impl/follows/response.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/external/pdap/impl/follows/response.py#L11 <391>

blank line at end of file
Raw output
./src/external/pdap/impl/follows/response.py:11:1: W391 blank line at end of file
5 changes: 0 additions & 5 deletions src/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,3 @@ def get_access_info(
token: Annotated[str, Depends(oauth2_scheme)]
) -> AccessInfo:
return SecurityManager().check_access(token, Permissions.SOURCE_COLLECTOR)

def require_permission(permission: Permissions):
def dependency(token: Annotated[str, Depends(oauth2_scheme)]) -> AccessInfo:
return SecurityManager().check_access(token, permission=permission)
return dependency
7 changes: 7 additions & 0 deletions tests/manual/external/pdap/test_get_follows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import pytest

Check warning on line 1 in tests/manual/external/pdap/test_get_follows.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/external/pdap/test_get_follows.py#L1 <100>

Missing docstring in public module
Raw output
./tests/manual/external/pdap/test_get_follows.py:1:1: D100 Missing docstring in public module


@pytest.mark.asyncio
async def test_get_user_followed_locations(pdap_client_dev):

Check warning on line 5 in tests/manual/external/pdap/test_get_follows.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/external/pdap/test_get_follows.py#L5 <103>

Missing docstring in public function
Raw output
./tests/manual/external/pdap/test_get_follows.py:5:1: D103 Missing docstring in public function
response = await pdap_client_dev.get_user_followed_locations()
print(response)

Check warning on line 7 in tests/manual/external/pdap/test_get_follows.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/external/pdap/test_get_follows.py#L7 <292>

no newline at end of file
Raw output
./tests/manual/external/pdap/test_get_follows.py:7:20: W292 no newline at end of file
1 change: 1 addition & 0 deletions tests/manual/external/pdap/test_match_agency.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@pytest.mark.asyncio
async def test_match_agency(pdap_client):
response = await pdap_client.match_agency(name="police")
print(response)
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading