scrapy.exporters.PythonItemExporter

Here are the examples of the python api scrapy.exporters.PythonItemExporter taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: scrapy
Source File: test_exporters.py
View license
    def _get_exporter(self, **kwargs):
        return PythonItemExporter(binary=False, **kwargs)

Example 2

Project: scrapy
Source File: test_exporters.py
View license
    def test_invalid_option(self):
        with self.assertRaisesRegexp(TypeError, "Unexpected options: invalid_option"):
            PythonItemExporter(invalid_option='something')

Example 3

Project: scrapy
Source File: test_exporters.py
View license
    def test_export_binary(self):
        exporter = PythonItemExporter(binary=True)
        value = TestItem(name=u'John\xa3', age=u'22')
        expected = {b'name': b'John\xc2\xa3', b'age': b'22'}
        self.assertEqual(expected, exporter.export_item(value))