in tbapi/__init__.py [0:0]
def tryCursor(self, stream: 'TickStream', options: SelectionOptions) -> 'TickCursor':
'''contextmanager version of createCursor. Usage:
```
with db.newCursor(stream, options) as cursor:
while cursor.next():
message = cursor.getMessage()
```
'''
cursor = None
try:
cursor = self.__createCursor(stream, options)
yield cursor
finally:
cursor.close()