sdk: implement support for with-resources statement

with API(url='', ...) as api:
  api...

Change-Id: I7e6f70355e8379cdddefa31d9e77452aa719fe0d
Signed-off-by: Michael pasternak <mpastern@redhat.com>