Malformed or invalid request

  1. Describe the issue briefly
    In postman api is working fine, but in python ‘Malformed or invalid request’ error is occurring again and again. i have pushed my code, please look at it.

  2. How much time have you spent debugging this issue?
    (Please spend at least 15 minutes to resolve the issue on your own before posting a new topic here)
    4 hours

  3. What is your hypothesis?
    i have followed the cURL command pattern to give image_url. header is used for api key. and i’m trying to get json script in my file terminal first. but getting {‘status’: {‘code’: 11102, ‘description’: ‘Invalid request’, ‘details’: ‘Malformed or invalid request’}} error instead.

Your parameters aren’t correct.
Tip: Check the Authorization parameter.

can you tell me what is the correct format of using api Key in authorization beacuse I can’t resolve my issue from last two hour

Try importing the code in Postman.
Check the parameters there and then compare it to the python files.
It should be the same as that.

Ok,My response is giving me Json object :heart_eyes:alright.

1 Like

Hardest part is over. You are just one step away.
Now it’s just to extracting the tags and just one more task.


Ok one more query, do we have to extract the different names from our json object and then have to add all those names into list and then finally returning it?

1 Like

Going in right direction. Read TODO’s clearly mentioned there

thank you sir, for quick response. And i solved this issue.

Hey your issue resolved ? because I am getting same issue form past 2 hrs. I am writting the exact code which I have converted using curl to python converter

Look at the Authorization header mathod in postman. Use same format (even spaces and case sensitivity).
And you need to convert your data parameter(in which you store your image url) into json.(a simple json function)
For details, visit following links…

And Google your issues. It really helps.

Authorization syntax is correct
My problem is about the data parameter .
please provide some hint

i can’t give you the straight forward answer…thus

  1. look at cURL structure, under -d. this is your data parameter.
  2. google your issue. you will find out the syntax.

feel free to ask again…

Yes i understood that
But tafter converting the data into python we get dictionary now do we need to provide entire dictionary or only specific value while passing it into http request
please help on this

we need to return specific values only…
and these values are tags. which we want to suggest.

1 Like

No my question was regarding the data which we pass in method
Here at the end we are passing only specific value or entire dictionary we got after converting the json object

Whatever data is needed by request should be in Json format in this case. Try printing type(data). You will get the clue.

Previously when used requests in file data was passed in form of dictionaries then how can the data be passed as json in function

Because you have set Content-Type =application/json

1 Like

hey how did you resolve the problem??