Can't restore object from trashcan. Why?

I have a latest release of GSE.
I try to restore from trashcan by this code:


But i got error:

TypeError: restore() got an unexpected keyword argument 'id'

I didnt undstand, why ‘id’ is a “unexpected keyword” ?

For details about your issue please read

See for the gmp.restore API.

1 Like

Hi, tnx for reply.
I’ve read links that you provided, i rewrite my code as:


Where “my_task_id” var really contains the id of task moved to trashcan.
But i have new error:
Error in response. Failed to find resource 'b5beea97-ca23-48c7-a858-056fd6534424'", <Element restore_response at 0x7f8cd4c4e448>

Now what i do wrong ?

Mistyped id?
Or the resource vanished from the trashcan in the meantime? It’s 4d since your OP, so maybe some auto cleaning kicked in?
How did you originally know it’s there? If you use the same method to know if it’s still there, is it still there?
Or maybe it’s part of something which is missing. Is the trash you try to recover partially restored?

Yes, there problem was wrong id.
I tried search as:
gmp.get_tasks(filter='name=Web test scan')

But, id of task ‘test scan’ returns, not id of moved task ‘Web test scan’

Then I renamed ‘Web test scan’ to ‘Web_test_scan’, and now i try to find moved task to trashcan by this code:

tasks = gmp.get_tasks(filter='name=Web_test_scan')
  for task in tasks.xpath('task'):
      my_task_id = task.get('id')
      print (task.find('name').text)
      print ('---- ' + my_task_id + ' ----')

But it doesn’t find task ‘Web_test_scan’ when it is in the trashcan.
When the task ‘Web_test_scan’ in restored, code above find ID perfectly.

How to find id of deleted task correctly ?


Please take a deep look at the API docs

tasks = gmp.get_tasks(filter='name=Web_test_scan', trash=True)

Thanks very much.

I can’t get used to instead of
The “” is slightly hard reading for me. i just skipped ‘trash’ keyword.

1 Like

Please always take a look at first. python-gvm does some things differently which aren’t easy to fix in the protocol. Also the docs for python-gvm are updated more often.