Scrapy, a fast high-level web crawling & scraping framework for Python.
Go to file
Adnan Awan 5d91ea12d6
Fix JsonItemExporter puts lone comma in the output if encoder fails (#5952)
* Partial fix for #3090 - only addresses JSON feeds.

* Adding test case for #3090 to Json Exporter

* Changing the deliberate-fail JSON example to a complex

* Further tightening JsonItemExporter behaviour to prevent corruption.

Based on Mikhail's observation that to_bytes can fail also, leading
to the same dangling comma as the failure to encode to JSON.

Added a new test case to avoid reversion.

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Add initial changes from cathal's PR
- https://github.com/scrapy/scrapy/issues/3090

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Handle exception not to add empty item.
- https://github.com/scrapy/scrapy/issues/3090

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Add comment for handling the exception
- https://github.com/scrapy/scrapy/issues/3090

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Remove unused import
- https://github.com/scrapy/scrapy/issues/3090

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Fix invalid json issue
- https://github.com/scrapy/scrapy/issues/3090

* [scrapy] JsonItemExporter puts lone comma in the output if encoder fails

- Perform CR changes
- https://github.com/scrapy/scrapy/issues/3090

---------

Co-authored-by: Cathal Garvey <cathalgarvey@cathalgarvey.me>
2023-07-22 23:13:40 +05:00
.github Add 3.12 CI jobs. 2023-07-22 17:55:32 +04:00
artwork artwork/README.rst: add missing articles (#5827) 2023-02-14 09:42:43 +01:00
docs Adding support for Windows of absolute pathlib.Path objects in FeedExporter (#5939) 2023-06-22 07:04:06 +02:00
extras Upgrade CI tools 2023-02-02 06:37:40 +01:00
scrapy Fix JsonItemExporter puts lone comma in the output if encoder fails (#5952) 2023-07-22 23:13:40 +05:00
sep Update black version and fix minor typos and punctuations 2023-02-03 11:52:20 +05:30
tests Fix JsonItemExporter puts lone comma in the output if encoder fails (#5952) 2023-07-22 23:13:40 +05:00
.bandit.yml Update tool versions (#5908) 2023-04-24 09:34:34 +02:00
.bumpversion.cfg Bump version: 2.8.0 → 2.9.0 2023-05-08 14:30:06 +04:00
.coveragerc added disable_warnings instruction to .coveragerc 2023-01-31 14:28:08 -08:00
.flake8 ignoring E203 flake8 error 2022-11-29 15:06:54 -03:00
.git-blame-ignore-revs ignoring last changes made by black for blame 2022-12-29 12:51:05 -03:00
.gitattributes Maybe the problem is not in the code after all 2020-08-13 06:35:09 +02:00
.gitignore refact: add Osx DS_Store file to gitignore 2022-10-03 00:48:12 -03:00
.isort.cfg fix .isort.cfg 2023-01-27 14:59:08 -06:00
.pre-commit-config.yaml Bump isort and flake8 versions. 2023-06-18 18:38:56 +04:00
.readthedocs.yml Use Python 3.11 as the default in CI (#5696) 2022-10-27 14:00:36 +02:00
AUTHORS Scrapinghub → Zyte 2021-02-02 15:03:20 +01:00
CODE_OF_CONDUCT.md Update Code of Conduct to Contributor Covenant v2.1 2022-10-28 02:13:37 +02:00
CONTRIBUTING.md Be consistent with domain used for links to documentation website 2019-01-31 01:28:53 -03:00
INSTALL.md Update and rename INSTALL to INSTALL.md 2022-10-06 19:58:48 +02:00
LICENSE added oxford commas to LICENSE 2018-06-01 21:48:43 -03:00
MANIFEST.in Include additional files in sdists 2018-11-16 13:38:19 -05:00
NEWS added NEWS file pointing to docs/news.rst 2012-04-28 23:32:51 -03:00
README.rst Drop Python 3.7 support. 2023-06-18 18:37:50 +04:00
codecov.yml codecov config: disable project check, tweak PR comments 2017-05-19 00:01:27 +05:00
conftest.py Skip more non-test files during discovery. 2023-07-22 17:54:55 +04:00
pylintrc Update pylint exceptions, and run pylint by default with tox 2023-02-02 06:52:01 +01:00
pytest.ini Simplify skipping uvloop tests. 2023-07-22 17:44:37 +04:00
setup.cfg Ignore typing for twisted.internet.reactor globally. 2023-01-27 23:19:44 +04:00
setup.py Add 3.12 CI jobs. 2023-07-22 17:55:32 +04:00
tox.ini Merge branch 'master' into typing-utils 2023-06-24 18:31:56 +04:00

README.rst

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head>
https://scrapy.org/img/scrapylogo.png

Scrapy

Overview

Scrapy is a fast high-level web crawling and web scraping framework, used to crawl websites and extract structured data from their pages. It can be used for a wide range of purposes, from data mining to monitoring and automated testing.

Scrapy is maintained by Zyte (formerly Scrapinghub) and many other contributors.

Check the Scrapy homepage at https://scrapy.org for more information, including a list of features.

Requirements

  • Python 3.8+
  • Works on Linux, Windows, macOS, BSD

Install

The quick way:

System Message: WARNING/2 (<stdin>, line 69)

Cannot analyze code. Pygments package not found.

.. code:: bash

    pip install scrapy

See the install section in the documentation at https://docs.scrapy.org/en/latest/intro/install.html for more details.

Documentation

Documentation is available online at https://docs.scrapy.org/ and in the docs directory.

Releases

You can check https://docs.scrapy.org/en/latest/news.html for the release notes.

Community (blog, twitter, mail list, IRC)

See https://scrapy.org/community/ for details.

Contributing

See https://docs.scrapy.org/en/master/contributing.html for details.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct.

By participating in this project you agree to abide by its terms. Please report unacceptable behavior to opensource@zyte.com.

Companies using Scrapy

See https://scrapy.org/companies/ for a list.

Commercial Support

See https://scrapy.org/support/ for details.

</html>