Skip to content

iter() not handling meta=None gracefully #145

Closed
@BurnzZ

Description

@BurnzZ

I got a bit of a trouble when having the small code snippet below:

def get_spider_items(jobkey, meta=None):
    CLIENT.get_job(jobkey).items.iter(meta=meta)  # CLIENT was instantiated before

get_spider_items("1/2/3")

This results in something like:

  File "/app/python/lib/python3.6/site-packages/scrapinghub/client/proxy.py", line 113, in iter
    drop_key = '_key' not in apiparams.get('meta', [])
TypeError: argument of type 'NoneType' is not iterable

A workaround would something like the one below, although this would be much better when the package handles it:

meta = derive_something_with_meta() or []
get_spider_items("1/2/3", meta=meta)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions