rbw / aiosnow

Asynchronous ServiceNow Library
MIT License
73 stars 12 forks source link

Rework Application argument handling #73

Closed rbw closed 4 years ago

rbw commented 4 years ago

The Application constructor now expects address as first positional argument, followed by a set of keyword arguments.

>>> import snow
>>> app = snow.Application(
... "test.service-now.com",
... basic_auth=("test", "testtest"),
... verify_ssl=False)
>>> print(app.config)
<ConfigSegment {'address': 'test.service-now.com', 'session': <ConfigSegment {'use_ssl': True, 'basic_auth': ('test', 'testtest'), 'verify_ssl': False}>}>

Also, this PR adds support for passing a snow-compatible aiohttp.ClientSession object directly to snow.Application.

>>> app = snow.Application(
... "test.service-now.com",
... session=aiohttp.ClientSession(response_class=snow.request.Response))

Note: