librelist archives

« back to archive

data in requests.get() ignored

data in requests.get() ignored

From:
Aljoša Mohorović
Date:
2011-11-02 @ 18:51
i've expected requests.get(url, data={'test':1}) and
requests.post(url, data={'test':1}) to work the same way but only post
data works.
any plans to make this work or should i just manually encode data and
append to url?

Aljosa

Re: [requests] data in requests.get() ignored

From:
Kenneth Reitz
Date:
2011-11-02 @ 18:56
the 'data' parameter is for body data. You should be using the 'params' 
parameter for URL queries.
--
Kenneth Reitz




On Nov 2, 2011, at 2:51 PM, Aljoša Mohorović wrote:

> i've expected requests.get(url, data={'test':1}) and
> requests.post(url, data={'test':1}) to work the same way but only post
> data works.
> any plans to make this work or should i just manually encode data and
> append to url?
> 
> Aljosa

Re: [requests] data in requests.get() ignored

From:
Aljoša Mohorović
Date:
2011-11-02 @ 19:09
On Wed, Nov 2, 2011 at 7:56 PM, Kenneth Reitz <me@kennethreitz.com> wrote:
> the 'data' parameter is for body data. You should be using the 'params' 
parameter for URL queries.

please consider adding more info to docs about difference between
params and data.
ignoring strictly technical stuff, from point of usability data and
params are the same thing the only difference being request method.

Aljosa

Re: [requests] data in requests.get() ignored

From:
Kenneth Reitz
Date:
2011-11-02 @ 19:11
Params is consistently for url parameters in all methods.  
Data is consistently for body data in all applicable methods. Get doesn't 
have the method because people don't upload body data with get requests.

--  
Kenneth Reitz


On Wednesday, November 2, 2011 at 3:09 PM, Aljoša Mohorović wrote:

> On Wed, Nov 2, 2011 at 7:56 PM, Kenneth Reitz <me@kennethreitz.com 
(mailto:me@kennethreitz.com)> wrote:
> > the 'data' parameter is for body data. You should be using the 
'params' parameter for URL queries.
>  
>  
> please consider adding more info to docs about difference between
> params and data.
> ignoring strictly technical stuff, from point of usability data and
> params are the same thing the only difference being request method.
>  
> Aljosa  

Re: [requests] data in requests.get() ignored

From:
Aljoša Mohorović
Date:
2011-11-02 @ 19:58
On Wed, Nov 2, 2011 at 8:11 PM, Kenneth Reitz <me@kennethreitz.com> wrote:
> Params is consistently for url parameters in all methods.
> Data is consistently for body data in all applicable methods. Get doesn't
> have the method because people don't upload body data with get requests.

thanks for clearing this for me, consider adding this info in
quickstart section and raising a warning or error when data is used
with get request.

Aljosa