Skip to content

Conversation

@sigmavirus24
Copy link
Contributor

Closes #2025

@sigmavirus24 sigmavirus24 self-assigned this Sep 30, 2014
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would get passed through with the kwargs, right, so I guess this is just so people know about the parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sigmavirus24 sigmavirus24 changed the title Add json Add json parameter Sep 30, 2014
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on changing that already. The problem is that the module json is imported at the top and needs to be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by aliasing json_dumps = json.dumps at the top of the module. Not sure I like it, but apparently import semantics are such that requests.compat.json can't be imported from (e.g., you can't do from .compat.json import dumps). Can you think of a better solution to avoid the local variable/parameter from shadowing the top-level module name beyond doing from . import compat and then doing compat.json.dumps?

- Don't _ prefix json in prepare_body
- Don't initialize json to []
- Don't initialize json to {}
- Reorder parameters to PreparedRequest.prepare
- Remove extra parentheses
- Update docstring
@sigmavirus24
Copy link
Contributor Author

@Lukasa @kevinburke care to take another look at this?

@Lukasa
Copy link
Member

Lukasa commented Oct 5, 2014

LGTM

@kennethreitz
Copy link
Contributor

omg I'm so excited

❤️ ✨ 🍰 🌹 🍰 ✨ ❤️

kennethreitz added a commit that referenced this pull request Oct 5, 2014
@kennethreitz kennethreitz merged commit 1e79cf6 into psf:master Oct 5, 2014
@sigmavirus24
Copy link
Contributor Author

@willingc thank you so much for your hard work on this. 🍰 (Those emoji from @kennethreitz are for you ;))

@willingc
Copy link
Contributor

willingc commented Oct 5, 2014

Thank you @sigmavirus24 for your support and mentoring 🎸 🌅 🌲 , @Lukasa for the review 🐱 🐈 😸 , and @kennethreitz for the community atmosphere 📷 ✌️ 🎸

@kennethreitz
Copy link
Contributor

@willingc thank YOU, and you're welcome :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm late to the party, was out - wouldn't this also change the meaning for anyone who creates a Request by hand, eg

params = {'date_created': '1-1-14'}
req = Request('GET', 'http://jsonip.com', {'User-Agent': 'foobar'}, None, {}, params)

where now suddenly params is JSON data?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON Upload

5 participants