Update image issue
kantmichel opened this issue ยท 1 comments
Hi,
Thanks so much for this repository! Really nice ๐
I'm trying to update images (attachments in AirTable), but there's an error when doing this. Here's the code:
data = { "Image" : {"url": "https://url.image.com/asset.3246874.jpg"}}
at.update('test', "9876dlafjkl", data)
as you see the image requires nested information about the image. The only requirement is the URL. Others are optional.
Here's the error i'm getting. Unfortunately the error after this tells nothing.
HTTPError Traceback (most recent call last)
C:\Continuum\Anaconda\envs\company-image-retreiver\lib\site-packages\airtable-0.3.1-py3.6.egg\airtable\airtable.py in __request(self, method, url, params, payload)
58 message = None
---> 59 r.raise_for_status()
60 except requests.exceptions.HTTPError as e:
C:\Continuum\Anaconda\envs\company-image-retreiver\lib\site-packages\requests\models.py in raise_for_status(self)
927 if http_error_msg:
--> 928 raise HTTPError(http_error_msg, response=self)
929
HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.airtable.com/v0/xxxxxxxxxxxxxxxxxx`
HTTPError 422 according to AirTable:
Invalid Request The request data is invalid. This includes most of the base-specific validations. You will receive a detailed error message and code pointing to the exact issue.
Unfortunately there is no detailed error message pointing to the exact issue.
Hope you can help! What's going wrong with updating the images?
ended up "fixing" it and identified the way to do this:
data = {"Typology": "Coffee", "Image" : [{"url": "https://order.blabla.co.uk/peo2/some/67/11/asset.123456.jpg"},{"url": "https://order.blabla.co.uk/peo2/something/68/39/asset.5648.jpg"}]}
at.update('test', "recoCNAIQjMCuRbDG", data)
need to send the image dictionary as list. Then multiple can be added by grouping them in their own dictionary.