Skip to content

AttributeError: 'str' object has no attribute 'create_http_request' #1

Open
@KoffieOmar

Description

@KoffieOmar

I'm trying to download a file I uploaded:

cellsApi = asposecellscloud.apis.cells_api.CellsApi(secret, secret, "v3.0")
download_response = cellsApi.download_file('test.xlsx')

I get the following error:

In [12]: download_response = cellsApi.download_file_('test.xlsx')

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[12], line 1
----> 1 download_response = cellsApi.download_file_('test.xlsx')

File ~/.pyenv/versions/3.9.5/envs/MYENV/lib/python3.9/site-packages/asposecellscloud/apis/cells_api.py:50573, in CellsApi.download_file_(self, path, **kwargs)
  50572 def download_file_(self, path, **kwargs):
> 50573     warnings.warn("CellsApi is deprecated", DeprecationWarning)
  50574     """
  50575     Download file
  50576     This method makes a synchronous HTTP request by default. To make an
   (...)
  50591              returns the request thread.
  50592     """
  50593     kwargs['_return_http_data_only'] = True

NameError: name 'warnings' is not defined

In [13]:

In [13]: download_response = cellsApi.download_file('test.xlsx')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[13], line 1
----> 1 download_response = cellsApi.download_file('test.xlsx')

File ~/.pyenv/versions/3.9.5/envs/MYENV/lib/python3.9/site-packages/asposecellscloud/apis/cells_api.py:14508, in CellsApi.download_file(self, request, **kwargs)
  14506     return self.download_file_with_http_info(request,**kwargs)
  14507 else:
> 14508     (data) = self.download_file_with_http_info(request,**kwargs)
  14509     return data

File ~/.pyenv/versions/3.9.5/envs/MYENV/lib/python3.9/site-packages/asposecellscloud/apis/cells_api.py:14527, in CellsApi.download_file_with_http_info(self, request, **kwargs)
  14524     params[key] = val
  14525 del params['kwargs']
> 14527 http_params = request.create_http_request(self.api_client)
  14528 return self.api_client.call_api(http_params['path'], http_params['method'],
  14529                                 None,
  14530                                 http_params['query_params'],
   (...)
  14540                                 _request_timeout=params.get('_request_timeout'),
  14541                                 collection_formats=http_params['collection_formats'])

AttributeError: 'str' object has no attribute 'create_http_request'

What is the correct way of uploading/downloading files? 🤔

Uploading and downloading kind of works with old versions of the sdk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions