kittycad.client

Classes

Client([base_url, cookies, headers, ...])

A Client which has been authenticated for use on secured endpoints of the KittyCAD API.

ClientFromEnv([base_url, token, cookies, ...])

A Client which has been authenticated for use on secured endpoints that uses the KITTYCAD_API_TOKEN environment variable for the authentication token.

class kittycad.client.Client(base_url='https://api.kittycad.io', *, token, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source][source]

A Client which has been authenticated for use on secured endpoints of the KittyCAD API.

Method generated by attrs for class Client.

__annotations__ = {'base_url': <class 'str'>, 'cookies': typing.Dict[str, str], 'headers': typing.Dict[str, str], 'timeout': <class 'float'>, 'token': <class 'str'>, 'verify_ssl': typing.Union[str, bool, ssl.SSLContext]}[source]
__attrs_attrs__ = (Attribute(name='token', default=NOTHING, 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=True, inherited=False, on_setattr=None, alias='token'), Attribute(name='base_url', default='https://api.kittycad.io', 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'), 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=False, 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=False, 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=False, 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=False, on_setattr=None, alias='verify_ssl'))[source]
__dict__ = mappingproxy({'__module__': 'kittycad.client', '__annotations__': {'token': <class 'str'>, 'base_url': <class 'str'>, 'cookies': typing.Dict[str, str], 'headers': typing.Dict[str, str], 'timeout': <class 'float'>, 'verify_ssl': typing.Union[str, bool, ssl.SSLContext]}, '__doc__': 'A Client which has been authenticated for use on secured endpoints of the KittyCAD API.', 'get_headers': <function Client.get_headers>, 'with_headers': <function Client.with_headers>, 'get_cookies': <function Client.get_cookies>, 'with_cookies': <function Client.with_cookies>, 'get_timeout': <function Client.get_timeout>, 'with_timeout': <function Client.with_timeout>, 'with_base_url': <function Client.with_base_url>, '__dict__': <attribute '__dict__' of 'Client' objects>, '__weakref__': <attribute '__weakref__' of 'Client' objects>, '__attrs_attrs__': (Attribute(name='token', default=NOTHING, 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=True, inherited=False, on_setattr=None, alias='token'), Attribute(name='base_url', default='https://api.kittycad.io', 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'), 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=False, 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=False, 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=False, 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=False, on_setattr=None, alias='verify_ssl')), '__repr__': <function Client.__repr__>, '__eq__': <function Client.__eq__>, '__ne__': <function Client.__ne__>, '__lt__': <function Client.__lt__>, '__le__': <function Client.__le__>, '__gt__': <function Client.__gt__>, '__ge__': <function Client.__ge__>, '__hash__': None, '__init__': <function Client.__init__>, '__match_args__': ('base_url',)})[source]
__eq__(other)[source]

Method generated by attrs for class Client.

__ge__(other)[source]

Method generated by attrs for class Client.

__gt__(other)[source]

Method generated by attrs for class Client.

__hash__ = None[source]
__init__(base_url='https://api.kittycad.io', *, token, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source]

Method generated by attrs for class Client.

__le__(other)[source]

Method generated by attrs for class Client.

__lt__(other)[source]

Method generated by attrs for class Client.

__match_args__ = ('base_url',)[source]
__module__ = 'kittycad.client'[source]
__ne__(other)[source]

Method generated by attrs for class Client.

__repr__()[source]

Method generated by attrs for class Client.

base_url: str[source]
cookies: Dict[str, str][source]
get_cookies()[source][source]
Return type:

Dict[str, str]

get_headers()[source][source]

Get headers to be used in all endpoints

Return type:

Dict[str, str]

get_timeout()[source][source]
Return type:

float

headers: Dict[str, str][source]
timeout: float[source]
token: str[source]
verify_ssl: Union[str, bool, SSLContext][source]
with_base_url(url)[source][source]

Get a new client matching this one with a new base url

Return type:

Client

with_cookies(cookies)[source][source]

Get a new client matching this one with additional cookies

Return type:

Client

with_headers(headers)[source][source]

Get a new client matching this one with additional headers

Return type:

Client

with_timeout(timeout)[source][source]

Get a new client matching this one with a new timeout (in seconds)

Return type:

Client

class kittycad.client.ClientFromEnv(base_url='https://api.kittycad.io', token=NOTHING, *, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source][source]

A Client which has been authenticated for use on secured endpoints that uses the KITTYCAD_API_TOKEN environment variable for the authentication token.

Method generated by attrs for class ClientFromEnv.

__annotations__ = {'token': <class 'str'>}[source]
__attrs_attrs__ = (Attribute(name='base_url', default='https://api.kittycad.io', 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=True, on_setattr=None, alias='base_url'), 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'))[source]
__dict__ = mappingproxy({'__module__': 'kittycad.client', '__annotations__': {'token': <class 'str'>, 'base_url': '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 environment variable for the authentication token.', 'set_token': <function ClientFromEnv.set_token>, 'get_headers': <function ClientFromEnv.get_headers>, '__attrs_attrs__': (Attribute(name='base_url', default='https://api.kittycad.io', 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=True, on_setattr=None, alias='base_url'), 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')), '__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__': ('base_url', 'token')})[source]
__eq__(other)[source]

Method generated by attrs for class ClientFromEnv.

__ge__(other)[source]

Method generated by attrs for class ClientFromEnv.

__gt__(other)[source]

Method generated by attrs for class ClientFromEnv.

__hash__ = None[source]
__init__(base_url='https://api.kittycad.io', token=NOTHING, *, cookies=NOTHING, headers=NOTHING, timeout=120.0, verify_ssl=True)[source]

Method generated by attrs for class ClientFromEnv.

__le__(other)[source]

Method generated by attrs for class ClientFromEnv.

__lt__(other)[source]

Method generated by attrs for class ClientFromEnv.

__match_args__ = ('base_url', 'token')[source]
__module__ = 'kittycad.client'[source]
__ne__(other)[source]

Method generated by attrs for class ClientFromEnv.

__repr__()[source]

Method generated by attrs for class ClientFromEnv.

base_url: str[source]
cookies: Dict[str, str][source]
get_cookies()[source]
Return type:

Dict[str, str]

get_headers()[source][source]

Get headers to be used in authenticated endpoints

Return type:

Dict[str, str]

get_timeout()[source]
Return type:

float

headers: Dict[str, str][source]
set_token()[source][source]
timeout: float[source]
token: str[source]
verify_ssl: Union[str, bool, SSLContext][source]
with_base_url(url)[source]

Get a new client matching this one with a new base url

Return type:

Client

with_cookies(cookies)[source]

Get a new client matching this one with additional cookies

Return type:

Client

with_headers(headers)[source]

Get a new client matching this one with additional headers

Return type:

Client

with_timeout(timeout)[source]

Get a new client matching this one with a new timeout (in seconds)

Return type:

Client