Spider Middlewares¶
- class kingfisher_scrapy.spidermiddlewares.ConcatenatedJSONMiddleware[source]¶
If the spider’s
concatenated_json
class attribute isTrue
, yields each object of the File as a FileItem. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.LineDelimitedMiddleware[source]¶
If the spider’s
line_delimited
class attribute isTrue
, yields each line of the File as a FileItem. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.ValidateJSONMiddleware[source]¶
If the spider’s
validate_json
class attribute isTrue
, checks if the item’sdata
field is valid JSON. If not, yields nothing. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.RootPathMiddleware[source]¶
If the spider’s
root_path
class attribute is non-empty, replaces the item’sdata
with the objects at that prefix; if there are multiple releases, records or packages at that prefix, combines them into packages in groups of 100, and updates the item’sdata_type
if needed. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.AddPackageMiddleware[source]¶
If the spider’s
data_type
class attribute is “release” or “record”, wraps the item’sdata
in an appropriate package, and updates the item’sdata_type
. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.ResizePackageMiddleware[source]¶
If the spider’s
resize_package
class attribute isTrue
, splits the package into packages of 100 releases or records each. Otherwise, yields the original item.
- class kingfisher_scrapy.spidermiddlewares.ReadDataMiddleware[source]¶
If the item’s
data
is a file descriptor, replaces the item’sdata
with the file’s contents and closes the file descriptor. Otherwise, yields the original item.See also