inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
27 stars 35 forks source link

Upload Attachments method #77

Closed stijnloeys closed 3 years ago

stijnloeys commented 3 years ago

Dear all,

I tried uploading pdfs to stock items with the uploadAttachments method. But this only works for the first item. When i want to upload more, i get an error code:

Traceback (most recent call last): File "C:/Users/Stijn/Documents/InvenTreeTest/dupdfs.py", line 81, in uploadpdfs() File "C:/Users/Stijn/Documents/InvenTreeTest/dupdfs.py", line 78, in uploadpdfs lijstje[0].uploadAttachment(currentpath + "/" + str(index), comment="") File "C:\Users\Stijn\AppData\Roaming\Python\Python37\site-packages\inventree\stock.py", line 79, in uploadAttachment StockItemAttachment.upload(self._api, filename, comment, **kwargs) File "C:\Users\Stijn\AppData\Roaming\Python\Python37\site-packages\inventree\base.py", line 224, in upload if response and response.status_code in [200, 201]: AttributeError: 'dict' object has no attribute 'status_code'

Does anyone have any idea how I could fix this?

eeintech commented 3 years ago

@stijnloeys There was a problem with checking the response content, once #78 is merged it should be fixed