Skip to content

Commit

Permalink
Support for Updated Title Roles (#157)
Browse files Browse the repository at this point in the history
* api updates

* add tests

* update

* updates

* lint

* fixesg

* lint
  • Loading branch information
vvillait88 committed Sep 17, 2024
1 parent 62520ef commit 4fba3b6
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 204 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 People Data Labs
Copyright (c) 2024 People Data Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 8 additions & 8 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "peopledatalabs"
version = "4.0.2"
version = "4.1.0"
description = "Official Python client for the People Data Labs API"
homepage = "https://www.peopledatalabs.com"
repository = "https://github.com/peopledatalabs/peopledatalabs-python"
Expand Down
186 changes: 93 additions & 93 deletions requirements.txt

Large diffs are not rendered by default.

192 changes: 96 additions & 96 deletions requirements_dev.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/peopledatalabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from .main import PDLPY


__version__ = "4.0.2"
__version__ = "4.1.0"

__all__ = ["PDLPY"]
8 changes: 7 additions & 1 deletion src/peopledatalabs/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from enum import Enum
from typing import Optional
from typing import Optional, Literal

from pydantic.v1 import (
BaseModel,
Expand Down Expand Up @@ -36,6 +36,7 @@ class AdditionalParametersModel(BaseModel):
titlecase: Optional[bool]
data_include: Optional[str]
include_if_matched: Optional[bool]
updated_title_roles: Optional[bool]


class BaseSearchModel(BaseRequestModel):
Expand All @@ -48,6 +49,7 @@ class BaseSearchModel(BaseRequestModel):
from_: Optional[conint(ge=0, le=9999)]
scroll_token: Optional[str]
titlecase: Optional[bool]
updated_title_roles: Optional[bool]

@root_validator(pre=True)
def query_or_sql(cls, v):
Expand Down Expand Up @@ -131,3 +133,7 @@ class IPModel(BaseModel):
return_if_unmatched: Optional[bool]
pretty: Optional[bool]
titlecase: Optional[bool]
min_confidence: Optional[
Literal["very high", "high", "moderate", "low", "very low"]
]
updated_title_roles: Optional[bool]
2 changes: 1 addition & 1 deletion tests/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_version():
"""
Version check.
"""
assert __version__ == "4.0.2"
assert __version__ == "4.1.0"


@pytest.mark.usefixtures("fake_api_key")
Expand Down
17 changes: 15 additions & 2 deletions tests/client/test_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@pytest.mark.usefixtures("client_with_fake_api_key")
def test_ip_no_params_throw_error(client_with_fake_api_key):
"""
Tests calling the ip method without parameters.
Tests calling the IP method without parameters.
Should raise EmptyParametersException
"""
Expand All @@ -28,10 +28,23 @@ def test_ip_no_params_throw_error(client_with_fake_api_key):
@pytest.mark.usefixtures("client")
def test_api_endpoint_ip(client):
"""
Tests successful execution of ip API.
Tests successful execution of IP API.
"""
completion = client.ip(
ip="72.212.42.169",
)
assert isinstance(completion, requests.Response)
assert completion.status_code == 200


@pytest.mark.usefixtures("client")
def test_api_endpoint_ip_with_min_confidence(client):
"""
Tests successful execution of IP API with min_confidence.
"""
completion = client.ip(
ip="72.212.42.169",
min_confidence="very high",
)
assert isinstance(completion, requests.Response)
assert completion.status_code == 200
13 changes: 13 additions & 0 deletions tests/person/endpoints/test_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@ def test_api_endpoint_enrichment_list_values(client):
)
assert isinstance(enriched, requests.Response)
assert enriched.status_code == 200


@pytest.mark.usefixtures("client")
def test_api_endpoint_enrichment_with_updated_title_roles(client):
"""
Tests successful execution of enrichment API with updated_title_roles.
"""
enriched = client.person.enrichment(
email="varun@peopledatalabs.com",
updated_title_roles=True,
)
assert isinstance(enriched, requests.Response)
assert enriched.status_code == 200

0 comments on commit 4fba3b6

Please sign in to comment.