Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bad request(400) error!
#3
Hey manhsv,

if you look at the doc page for this 'add' service you can see it also has some required query parameters, in this case 'text'. So you need to also send this 'text' parameter as part of your request.

Also your request type is currently '-X GET' and '-X' is actually just a parameter specifying request method for the curl command so you can skip that and just go with GET or just simply using method requests.get() .

payload = {'text': 'some text here'}
response = requests.get(url, headers=headers, data=payload)
Reply


Messages In This Thread
Bad request(400) error! - by manhsv - Jan-13-2019, 09:16 AM
RE: Bad request(400) error! - by Larz60+ - Jan-13-2019, 06:01 PM
RE: Bad request(400) error! - by mlieqo - Jan-13-2019, 06:19 PM
RE: Bad request(400) error! - by manhsv - Jan-14-2019, 07:25 AM
RE: Bad request(400) error! - by mlieqo - Jan-14-2019, 09:17 AM
RE: Bad request(400) error! - by manhsv - Jan-14-2019, 12:51 PM
RE: Bad request(400) error! - by mlieqo - Jan-14-2019, 01:37 PM
RE: Bad request(400) error! - by manhsv - Jan-15-2019, 11:50 AM
RE: Bad request(400) error! - by hbknjr - Jan-15-2019, 01:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how can I correct the Bad Request error on my curl request tomtom 8 5,058 Oct-03-2021, 06:32 AM
Last Post: tomtom
  Empty response to request causing .json() to error t4keheart 1 10,042 Jun-26-2020, 08:35 PM
Last Post: bowlofred
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,924 Jun-18-2020, 08:07 AM
Last Post: buran
  urllib request error 404 Coco 2 4,400 May-11-2019, 02:47 PM
Last Post: Larz60+
  Error in request, cache key a21250450 2 3,102 Apr-02-2019, 11:20 AM
Last Post: a21250450

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020