| 52 | self.content = content |
| 53 | |
| 54 | def __init__(self, provider, handle=None): |
| 55 | if handle is None: |
| 56 | self._cb = core.BNDownloadInstanceCallbacks() |
| 57 | self._cb.context = 0 |
| 58 | self._cb.destroyInstance = self._cb.destroyInstance.__class__(self._destroy_instance) |
| 59 | self._cb.performRequest = self._cb.performRequest.__class__(self._perform_request) |
| 60 | self._cb.performCustomRequest = self._cb.performCustomRequest.__class__(self._perform_custom_request) |
| 61 | self._cb.freeResponse = self._cb.freeResponse.__class__(self._free_response) |
| 62 | self.handle = core.BNInitDownloadInstance(provider.handle, self._cb) |
| 63 | self.__class__._registered_instances.append(self) |
| 64 | else: |
| 65 | self.handle = core.handle_of_type(handle, core.BNDownloadInstance) |
| 66 | self._must_free = handle is not None |
| 67 | |
| 68 | def __del__(self): |
| 69 | if self._must_free: |