Scrapyd jobid value inside spider
I guess there is an easier way, but you can extract job id from command line args. IIRC, scrapyd launches a spider giving it a jobid in parameters. Just explore sys.args
where you need jobid.
You can get it from the SCRAPY_JOB
environment variable:
os.environ['SCRAPY_JOB']