This is probably a stupid question but its got me stumped coming from a Ruby background.
I have an object that looks like this when I try to print it.
Short story, within function scan, use scan.request.id.
scan
scan.request.id
See http://docs.celeryproject.org/en/latest/userguide/tasks.html?highlight=request#task-request-info