Skip to content

Commit

Permalink
Fix analyze API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
const-cloudinary committed Mar 19, 2024
1 parent faa21e3 commit a9682cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cloudinary/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,6 @@ def analyze(input_type, analysis_type, uri=None, **options):
:rtype: Response
"""
api_uri = ['analysis', 'analyze']
params = {'input_type': input_type, 'analysis_type': analysis_type, 'uri': uri}
api_uri = ['analysis', 'analyze', input_type]
params = {'analysis_type': analysis_type, 'uri': uri, 'parameters': options.get("parameters")}
return _call_v2_api('post', api_uri, params, **options)
5 changes: 2 additions & 3 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,16 +1216,15 @@ def test_analyze(self, mocker):
mocker.return_value = MOCK_RESPONSE

options = {
"input_type": "uri",
"analysis_type": "captioning",
"uri": "https://res.cloudinary.com/demo/image/upload/dog",
}

api.analyze(**options)
api.analyze(input_type="uri", **options)

uri = get_uri(mocker)
self.assertIn("/v2/", uri)
self.assertTrue(uri.endswith("/analysis/analyze"))
self.assertTrue(uri.endswith("/analysis/analyze/uri"))

params = get_json_body(mocker)
for param in options.keys():
Expand Down

0 comments on commit a9682cb

Please sign in to comment.