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

Pass info from FEEDS to ItemExporter #4606

StasDeep opened this issue Jun 1, 2020 · 2 comments · Fixed by #4768

Pass info from FEEDS to ItemExporter #4606

StasDeep opened this issue Jun 1, 2020 · 2 comments · Fixed by #4768


Copy link

StasDeep commented Jun 1, 2020


The new FeedExporter class doesn't allow to pass custom info to ItemExporter through the FEEDS setting.


My use-case is a bit too long to describe, but it can be minimized to the following: for example, I have a custom ItemExporter which I want to have different options for different feeds. Say I want to pass custom param option to it.

class CustomItemExporter(BaseItemExporter):
    def _configure(self, options, dont_fail=False):
        super()._configure(options, dont_fail)
        self.param = options.pop('param', None)
    def export_item(self, item):
        # Using self.param here

Ideally, I would like to do set it like this:

    uri_detail: {'format': 'custom', 'item_export_kwargs': {'param' : 'Detail'}},
    uri_overview: {'format': 'custom', 'item_export_kwargs': {'param' : 'Overview'} }

Describe alternatives you've considered

The only workaround I've found was to create a new FeedExporter class and override open_spider method to pass feed['item_export_kwargs'] to _get_exporter method.

Additional context

Will provide a PR this week.

Copy link

Gallaecio commented Jun 2, 2020

I implemented this in #4512, as I needed it there.

Copy link
Contributor Author

StasDeep commented Jun 2, 2020

@Gallaecio if I understand the changes correctly, it is now possible to pass it to FeedStorage. What I want, though, is passing custom args to ItemExporters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

2 participants