How to use the ipfshttpclient.utils.return_field function in ipfshttpclient

To help you get started, we’ve selected a few ipfshttpclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / py-ipfs-http-client / test / unit / test_utils.py View on Github external
def test_return_field_init(self):
		"""Tests utils.return_field.__init__()."""
		return_field = utils.return_field('Hash')
		assert return_field.field == 'Hash'
github ipfs / py-ipfs-http-client / test / unit / test_utils.py View on Github external
		@utils.return_field('Hash')
		def wrapper(string, *args, **kwargs):
			resp = {'Hash': expected_hash, 'string': string}
			return resp
		assert wrapper('Mary had a little lamb') == expected_hash
github ipfs / py-ipfs-http-client / ipfshttpclient / client.py View on Github external
    @utils.return_field('Hash')
    def add_str(self, string, **kwargs):
        """Adds a Python string as a file to IPFS.

        .. code-block:: python

            >>> c.add_str(u"Mary had a little lamb")
            'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'

        Also accepts and will stream generator objects.

        Parameters
        ----------
        string : str
            Content to be added as a file

        Returns
github ipfs / py-ipfs-http-client / ipfshttpclient / client / __init__.py View on Github external
	@utils.return_field('Hash')
	@base.returns_single_item
	def add_bytes(self, data, **kwargs):
		"""Adds a set of bytes as a file to IPFS.

		.. code-block:: python

			>>> client.add_bytes(b"Mary had a little lamb")
			'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'

		Also accepts and will stream generator objects.

		Parameters
		----------
		data : bytes
			Content to be added as a file
github ipfs / py-ipfs-http-client / ipfshttpclient / client.py View on Github external
    @utils.return_field('Hash')
    def add_bytes(self, data, **kwargs):
        """Adds a set of bytes as a file to IPFS.

        .. code-block:: python

            >>> c.add_bytes(b"Mary had a little lamb")
            'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'

        Also accepts and will stream generator objects.

        Parameters
        ----------
        data : bytes
            Content to be added as a file

        Returns
github ipfs / py-ipfs-http-client / ipfshttpclient / client / __init__.py View on Github external
	@utils.return_field('Hash')
	@base.returns_single_item
	def add_str(self, string, **kwargs):
		"""Adds a Python string as a file to IPFS.

		.. code-block:: python

			>>> client.add_str(u"Mary had a little lamb")
			'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'

		Also accepts and will stream generator objects.

		Parameters
		----------
		string : str
			Content to be added as a file