Blacksmith

Latest version: v4.0.5

Safety actively analyzes 710752 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 10

2.1.2

------------------------------
* Update dependency result to 0.9

2.1.1

------------------------------
* Fix consul service discovery support when ServiceAddress is empty.

2.1.0

------------------------------
* New method :meth:`blacksmith.ResponseBox.as_optional`
This method is usefull for response that has no return
schema and the response needs to be map to return something
else without raising a
:class:`blacksmith.domain.exceptions.NoResponseSchemaException`

2.0.0

------------------------------
* Fix concistency for :meth:`blacksmith.AsyncRouteProxy.collection_get` with
other HTTP Response Object as using a result type from the
:term:`result library`.

* Improve error handling. See :ref:`HTTP Errors`

Breaking Changes
~~~~~~~~~~~~~~~~

* The ``collection_get`` method in :class:`blacksmith.AsyncRouteProxy`
and :class:`blacksmith.SyncRouteProxy` return a Result type instead of
an iterator.

::

api = await cli("api")

In blacksmith 1.0
items: CollectionIterator[PartialItem] = await api.item.collection_get()

In blacksmith >=2.0
items: Result[
CollectionIterator[PartialItem], HTTPError
] = await api.item.collection_get()

Note that the :class:`blacksmith.HTTPError` can be replaced by your own format,
using the new parameter `error_parser` of the :class:`blacksmith.AsyncClientFactory`
and :class:`blacksmith.SyncClientFactory`.

See :ref:`HTTP Errors`

* The type of :class:`blacksmith.AsyncClientFactory`, :class:`blacksmith.AsyncClient`,
:class:`blacksmith.SyncClientFactory` and :class:`blacksmith.SyncClient` cannot be
used to specify collection and item types.

Deprecated
~~~~~~~~~~

* The :attr:`blacksmith.ResponseBox.response` is deprecated in favor of
the :meth:`blacksmith.ResponseBox.unwrap` method.

::

api = await cli("api")

In blacksmith 1.0
item: Item = await api.item.get(Get(id=id)).response

In blacksmith >=2.0
item: Item = await api.item.get(Get(id=id)).unwrap()
Or better
result_item: ResponseBox[Item] = await api.item.get(Get(id=id))
if result_item.is_ok():
item = result_item.unwrap() unwrap will raise if the result is an error.
else:
error = result_item.unwrap_err()

.. important::
The :class:`blacksmith.ResponseBox` as plenty of new method to
have the same mimic of the result type from the
:term:`result library`.

1.0.2

------------------------------
* Update dependencies

1.0.1

------------------------------
* Update dependencies

Page 5 of 10

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.