Open matecsaj opened 1 year ago
Citing John
I might be able to automate your patches. The generator I wrote already does various patches before and after running Swagger to permanently fix some known problems.
https://github.com/matecsaj/ebay_rest/blob/main/scripts/generate_code.py
After you make your modifications, please send me the before and after files. To make this more viable, please:
Citing Wang
I didn't really download the ebay_rest library, I just learning it before use it in product, but I could not understand how the upload_file works because I could not find the code it actually open/read the file, again I never wrote a test code to verify if it works or not.
For the patch, I suggest this
In file https://github.com/matecsaj/ebay_rest/blob/main/src/ebay_rest/api/sell_feed/api/task_api.py#L642
after Line 615 local_var_files = {}
append following code
local_var_files = {params.get('name'): params.get('file_name')}
Again I never downloaded this library so I just feel it should work.
After a few days of trying this is the code that works:
test_file = open(file_name, 'rb').read()
result = api.sell_feed_upload_file(
file=(file_name, test_file),
content_type="multipart/form-data",
task_id=task_id,
type='form-data',
file_name=file_name,
)
To make it work you need to add e few lines in sell_feed/api/task_api.py to make upload_file_with_http_info() aware of the 'file' attribute:
somewhere after the line 602:
all_params.append('file')
and after the line 652:
if 'file' in params:
form_params.append(('file', params['file'])) # noqa: E501
Once again, thank you! I'm intensely working on another project, so please forgive me for letting this be for several weeks. If you need a fresh release with this change sooner or are willing to submit a PR, please use scripts/generate_code.py to patch sell_feed/api/task_api.py and provide a unit test.
Swagger with OpenAPI contracts from eBay generate the core of this library, and they are not currently able to accept a path-file. Please ask eBay to solve the root problem; many voices will convince them of the need to act.
To learn more search in the Unit Tests for 'sell_feed_upload_file'.
Workarounds are suggested in the ReadMe search for 'How to upload a file?'.