symblai / symbl-docs

Symbl.ai open sources its documentation into a GitHub repository for you as a developer to actively develop through pull requests.
17 stars 42 forks source link

Async File Python Code - Needs Update #222

Open HuckMatt opened 3 years ago

HuckMatt commented 3 years ago

In the async file submission python code snippet, there are multiple areas where a boolean is expected in the params eg. 'detectPhrases': True,

The way the code snippet is currently written, when the params object is passed in the API request, it is still in the form of a Python dictionary object. Before sending in the request this object needs to be encoded so that the API reads the boolean values as a true boolean.

For example if params = {'detectPhrases': True} then the request: response = requests.request("POST", url, headers=headers, data=payload, params=params) will return a status 400. The resulting params will be in the form https://api.symbl.ai/v1/process/video?detectPhrases=True

In this example the capitol 'True' will not be accepted by the API and return a status 400.

The correct param format needs to be in the form https://api.symbl.ai/v1/process/video?detectPhrases=true

In order to make this request in python the params object needs to be encoded properly. For example params = json.dumps(params), or in the request response = requests.request("POST", url, headers=headers, data=payload, params=json.dumps(params))

ashish-patwal commented 3 years ago

@HuckMatt i would like to work on this issue . Can you please guide me to the files that needs correction ?

atom19-i commented 3 years ago

@visharma-symbl please review my PR.

atom19-i commented 3 years ago

@Akankshabhasin please review my PR..