Skip to content

Discover API errors with unexpected keyword argument 'json' #17

@MarkAWard

Description

@MarkAWard

I tried running the example from the docs (and other queries as well to this endpoint)

clearbit.Discovery.search(
  query={'tech': 'marketo', 'raised': '100000~'},
  sort='alexa_asc'
)

and i get an error from requests library saying: TypeError: request() got an unexpected keyword argument 'json'

clearbit package requirements are requests >= 0.8.8 and I am using requests==1.0.4 but the json parameter was added to requests in version 2.4.2. Upgrading the requirement version number would not be the right solution, I may suggest using the 'data' kwarg instead and encode the payload. But as a side note as well I noticed that this is making a POST while the docs have it as a GET...

When I tried to test this out though I still could not get a valid response but I may be doing something incorrect (same result when get is a post too)

endpoint = 'https://discovery.clearbit.com/v1/companies/search'
>>> resp = requests.get(endpoint, auth=(<key>, ''), 
                                data=json.dumps({"query": {"raised": "100000~", "tech": "marketo"}})
                                )
>>> resp.json()
{u'error': {u'message': u'"query" param is required. Check https://clearbit.com/docs.',
  u'type': u'validation'}}

This error that requests is throwing will happen for any of the other APIs that are using POST as well with an older requests version, but this was the first one I tested

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions