kittycad.client.ClientFromEnv
- class kittycad.client.ClientFromEnv(token=NOTHING, base_url='https://api.zoo.dev', *, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source][source]
Bases:
Client
A Client which has been authenticated for use on secured endpoints that uses the KITTYCAD_API_TOKEN or ZOO_API_TOKEN environment variable for the authentication token.
Optionally, you can use
ZOO_HOST
to set the base url. This implies you are hosting your own instance of the KittyCAD API.Method generated by attrs for class ClientFromEnv.
- __init__(token=NOTHING, base_url='https://api.zoo.dev', *, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source]
Method generated by attrs for class ClientFromEnv.
Methods
__init__
([token, base_url, cookies, ...])Method generated by attrs for class ClientFromEnv.
Get headers to be used in authenticated endpoints
with_base_url
(url)Get a new client matching this one with a new base url
with_cookies
(cookies)Get a new client matching this one with additional cookies
with_headers
(headers)Get a new client matching this one with additional headers
with_timeout
(timeout)Get a new client matching this one with a new timeout (in seconds)
Attributes
- __annotations__ = {'base_url': <class 'str'>, 'cookies': 'Dict[str, str]', 'headers': 'Dict[str, str]', 'timeout': 'float', 'token': <class 'str'>, 'verify_ssl': 'Union[str, bool, ssl.SSLContext]'}[source]
- __attrs_attrs__ = (Attribute(name='cookies', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Dict[str, str], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='cookies'), Attribute(name='headers', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Dict[str, str], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='headers'), Attribute(name='timeout', default=120.0, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'float'>, converter=None, kw_only=True, inherited=True, on_setattr=None, alias='timeout'), Attribute(name='verify_ssl', default=True, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Union[str, bool, ssl.SSLContext], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='verify_ssl'), Attribute(name='token', default=Factory(factory=<function ClientFromEnv.set_token>, takes_self=True), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='token'), Attribute(name='base_url', default='https://api.zoo.dev', validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='base_url'))[source]
- __dict__ = mappingproxy({'__module__': 'kittycad.client', '__annotations__': {'token': <class 'str'>, 'base_url': <class 'str'>, 'cookies': 'Dict[str, str]', 'headers': 'Dict[str, str]', 'timeout': 'float', 'verify_ssl': 'Union[str, bool, ssl.SSLContext]'}, '__doc__': 'A Client which has been authenticated for use on secured endpoints that uses the KITTYCAD_API_TOKEN or ZOO_API_TOKEN environment variable for the authentication token.\n\n Optionally, you can use `ZOO_HOST` to set the base url.\n This implies you are hosting your own instance of the KittyCAD API.\n ', 'set_token': <function ClientFromEnv.set_token>, 'get_headers': <function ClientFromEnv.get_headers>, '__attrs_attrs__': (Attribute(name='cookies', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Dict[str, str], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='cookies'), Attribute(name='headers', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Dict[str, str], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='headers'), Attribute(name='timeout', default=120.0, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'float'>, converter=None, kw_only=True, inherited=True, on_setattr=None, alias='timeout'), Attribute(name='verify_ssl', default=True, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=typing.Union[str, bool, ssl.SSLContext], converter=None, kw_only=True, inherited=True, on_setattr=None, alias='verify_ssl'), Attribute(name='token', default=Factory(factory=<function ClientFromEnv.set_token>, takes_self=True), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='token'), Attribute(name='base_url', default='https://api.zoo.dev', validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='base_url')), '__repr__': <function ClientFromEnv.__repr__>, '__eq__': <function ClientFromEnv.__eq__>, '__ne__': <function ClientFromEnv.__ne__>, '__lt__': <function ClientFromEnv.__lt__>, '__le__': <function ClientFromEnv.__le__>, '__gt__': <function ClientFromEnv.__gt__>, '__ge__': <function ClientFromEnv.__ge__>, '__hash__': None, '__init__': <function ClientFromEnv.__init__>, '__match_args__': ('token', 'base_url')})[source]
- __init__(token=NOTHING, base_url='https://api.zoo.dev', *, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source]
Method generated by attrs for class ClientFromEnv.
- with_cookies(cookies)[source]
Get a new client matching this one with additional cookies
- Return type: