@@ -40,7 +40,8 @@ def get(self, cid: base.cid_t, **kwargs: base.CommonArgs):
4040 return self ._client .request ('/dag/get' , args , decoder = 'json' , ** kwargs )
4141
4242 @base .returns_single_item (base .ResponseBase )
43- def put (self , data : utils .clean_file_t , ** kwargs : base .CommonArgs ):
43+ def put (self , data : utils .clean_file_t , format : str = 'cbor' ,
44+ input_enc : str = 'json' , ** kwargs : base .CommonArgs ):
4445 """Decodes the given input file as a DAG object and returns their key
4546
4647 .. code-block:: python
@@ -63,12 +64,18 @@ def put(self, data: utils.clean_file_t, **kwargs: base.CommonArgs):
6364 ----------
6465 data
6566 IO stream object of path to a file containing the data to put
67+ format
68+ Format that the object will be added as. Default: cbor
69+ input_enc
70+ Format that the input object will be. Default: json
6671
6772 Returns
6873 -------
6974 dict
7075 Cid with the address of the dag object
7176 """
77+ opts = {'format' : format , 'input-enc' : input_enc }
78+ kwargs .setdefault ('opts' , {}).update (opts )
7279 body , headers = multipart .stream_files (data , chunk_size = self .chunk_size )
7380 return self ._client .request ('/dag/put' , decoder = 'json' , data = body ,
7481 headers = headers , ** kwargs )
@@ -105,7 +112,7 @@ def imprt(self, data: utils.clean_file_t, **kwargs: base.CommonArgs):
105112 .. code-block:: python
106113
107114 >>> with open('data.car', 'rb') as file
108- ... client.dag.imprt(file)
115+ ... client.dag.imprt(file)
109116 {'Root': {
110117 'Cid': {
111118 '/': 'bafyreidepjmjhvhlvp5eyxqpmyyi7rxwvl7wsglwai3cnvq63komq4tdya'
0 commit comments