Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JsonResponse #6174

Merged
merged 8 commits into from
Dec 21, 2023
Merged

Added JsonResponse #6174

merged 8 commits into from
Dec 21, 2023

Conversation

jxlil
Copy link
Contributor

@jxlil jxlil commented Dec 7, 2023

Added a JsonResponse subclass to facilitate parsing of response content

if isinstance(response, JsonResponse):
    data = response.jmespath('object.[*]')
    ...
elif isinstance(response, HtmlResponse):
    data = response.xpath('//p')
    ...
else:
    ...

Fixes #6069, closes #6171

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Merging #6174 (1fb611e) into master (fa690fb) will increase coverage by 0.02%.
Report is 5 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6174      +/-   ##
==========================================
+ Coverage   88.59%   88.62%   +0.02%     
==========================================
  Files         159      160       +1     
  Lines       11582    11611      +29     
  Branches     1885     1891       +6     
==========================================
+ Hits        10261    10290      +29     
  Misses        994      994              
  Partials      327      327              
Files Coverage Δ
scrapy/http/__init__.py 100.00% <100.00%> (ø)
scrapy/http/response/json.py 100.00% <100.00%> (ø)
scrapy/responsetypes.py 91.78% <ø> (ø)

... and 11 files with indirect coverage changes

Co-authored-by: Adrián Chaves <adrian@chaves.io>
scrapy/http/response/json.py Outdated Show resolved Hide resolved
Copy link
Member

@wRAR wRAR left a comment

Choose a reason for hiding this comment

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

Thanks!

@Gallaecio
Copy link
Member

Thank you!!!

@Gallaecio Gallaecio merged commit d25cfe5 into scrapy:master Dec 21, 2023
26 checks passed
@jxlil jxlil deleted the feat/added-jsonresponse branch December 21, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add JsonResponse
3 participants