Giter Site home page Giter Site logo

peopledatalabs / peopledatalabs-python Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 4.0 353 KB

A Python client for the People Data Labs API

Home Page: https://docs.peopledatalabs.com/docs/python-sdk

License: MIT License

Python 99.18% Shell 0.82%
company-data person-data company-enrichment person-enrichment api companies company-search contact-data data-enrichment enrichment

peopledatalabs-python's People

Contributors

austinseftonpdl avatar dependabot[bot] avatar jbot29 avatar lupodellasleppa avatar martimlobao avatar vvillait88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

peopledatalabs-python's Issues

Trying to upgrade to pydantic > 2.0 is blocked by peopledatalabs

Describe the bug
We are trying to upgrade a project dependency to pydantic > 2.0 and are blocked by not having a version of this project that supports it.

To Reproduce
poetry add pydantic==^2.0

Expected behavior
There could be a version of this package that was compatible with newer versions of pydantic

Screenshots
If applicable, add screenshots to help explain your problem.

  • peopledatalabs Library Version: 2.0.1
  • Python Version 3.10

Don't use Env var VERSION as default value for PDLPY version property

Describe the bug
If the PDLP constructor is called like this:

client = PDLPY(
    api_key="YOUR API KEY",
)

the default value for version is settings.version, and it is populated with the env var VERSION if it's defined, which is a generic name that shouldn't be used as default value.

To Reproduce
$ export VERSION=latest
$ python -c "from peopledatalabs import PDLPY; client=PDLPY(api_key='YOUR API KEY')"

Expected behavior
IMHO the env var used should start with PDL_. In this case PDL_VERSION

Additional context

peopledatalabs version = 1.1.1
pedantic version = 1.9.2

Traceback

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 8, in __init__
  File "/usr/local/lib/python3.10/site-packages/pydantic/dataclasses.py", line 100, in _pydantic_post_init
    raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for PDLPY
version
  string does not match regex "^v[0-9]$" (type=value_error.str.regex; pattern=^v[0-9]$)

Replace version pegs with minimum required versions

This library currently pegs all dependencies to specific versions (i.e. using == in requirements.txt), instead of specifying minimum required versions (i.e. using >=). This practice makes it difficult to use this library in the context of larger projects, which are likely to have conflicting dependencies.

For example, I just tried installing this in a project that uses Prefect, and got this error:

image

These problems can be avoided if the People Data Labs library specifies minimum requirements, or version ranges where needed.

mutable default <class 'pydantic.types.SecretStr'> for field api_key is not allowed: use default_factory

Describe the bug
Pydantic complains that you're supplying a mutable type as the default value for a field in the PDLPY.api_key.

To Reproduce
Try to import the module: from peopledatalabs import PDLPY

Expected behavior
You should be able to import the module

Screenshots
N/A

  • peopledatalabs Library Version: 1.1.2
  • Python Version: 3.11.2

Additional context
Here's my stacktrace:

Traceback (most recent call last):
  File "/Users/me/Documents/workspace/pdl_api_test/src/main.py", line 11, in <module>
    from src.lib.pdl_api import PDLCLient
  File "/Users/me/Documents/workspace/pdl_api_test/src/lib/pdl_api.py", line 15, in <module>
    from peopledatalabs import PDLPY  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/peopledatalabs/__init__.py", line 6, in <module>
    from .main import PDLPY
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/peopledatalabs/main.py", line 30, in <module>
    @dataclass
     ^^^^^^^^^
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 265, in dataclass
    return wrap(_cls)
           ^^^^^^^^^^
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 260, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 159, in _process_class
    cls: Type['Dataclass'] = dataclasses.dataclass(  # type: ignore
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'pydantic.types.SecretStr'> for field api_key is not allowed: use default_factory

Support for sandbox API endpoints

Hi,

we're starting to integrate PDL into our backend. For our local and sandbox environments, we would like to use the sandbox API endpoints (https://docs.peopledatalabs.com/docs/sandbox-apis). However it seems that this client doesn't support it out of the box, the only way seems to set a BASE_PATH environment variable (from this line). The issue with this approach is that the naming of this variable is confusing, ideally it would be something like PDL_BASE_PATH.

Actually I'd suggest prefixing by PDL_ all environment variables that would override the settings to avoid conflicts with existing env vars.

Let me know what you think,

Cheers, Olivier

'required' parameter ignored in bulk person enrichment

When trying to use the required parameter in bulk person enrichment, it seems that it ends up being ignored. When calling directly the endpoint (e.g. with Postman) using the same request, it seems to work so the issue doesn't appear to come from the API.

One of the request being built:

{'metadata': {'key': '1'}, 'params': {'first_name': ['...'], 'last_name': ['...'], 'email': ['...'], 'min_likelihood': 6, 'required': 'work_email'}}

However, I'm getting back a 200 status code with a record that does not have a work_email field (null value)

I'm using version 1.1.3

`InvalidEndpontError`: Invalid method __post_init_post_parse (Pydantic validation error) when calling multiple endpoints with SDK

Describe the bug
InvalidEndpontError for endpoints:

  • Elasticsearch search
  • Bulk enrichment
  • Job search

Screenshot 2022-09-05 at 18 01 35

To Reproduce
Minimal reproduction

Screenshot 2022-09-05 at 18 01 52

Expected behavior
Endpoints return results

Screenshots
If applicable, add screenshots to help explain your problem.

  • peopledatalabs Library Version 1.1.0
  • Python Version 3.10.0

Additional context
Calling these endpoints, with the Python SDK was working correctly a few days ago and I've confirmed the endpoints are working correctly when the same parameters are passed directly to the API via an HTTP client

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.