I'm using python 3.9 and the requests package to upload images to my Piwigo gallery. I want to associate multiple tags with an image when I upload. My request code looks much like the following:
Doing this leads to erroneous square brackets and quotation marks in the uploaded tag names. See the following image for an example of the incorrect tag names. The tag containing no quotation marks or square brackets is the format I am expecting for all the tags.
I'm using python 3.9 and the requests package to upload images to my Piwigo gallery. I want to associate multiple tags with an image when I upload. My request code looks much like the following:
```
tags = ["some text", "more text"]
headers = {'Accept': 'application/json'}
params = {'format' : 'json', 'method' : 'pwg.images.addSimple', 'Content-Type' : 'form-data'}
files = {
'image' : open(filename, "rb")
}
data = {
'pwg_token' : pwg_token,
'tags' : json.dumps(tags)
}
requests.post(piwigo_url, headers=headers, params=params, data = data, files=files)
```
Doing this leads to erroneous square brackets and quotation marks in the uploaded tag names. See the following image for an example of the incorrect tag names. The tag containing no quotation marks or square brackets is the format I am expecting for all the tags.
<img width="1194" alt="Screen Shot 2022-06-30 at 11 55 04 AM" src="https://user-images.githubusercontent.com/108487316/176749619-9f4c48cd-53d1-4c96-accc-a92c62dc9f10.png">
<!-- github-sync-id:1290489725 -->
Piwigo is not expecting the tags to be a JSON encoded string. It could be a possibility: first we check if it's a JSON string, if it is, Piwigo decodes it and it becomes an array as expected.
For now, you can either send an array (not JSON encoded) or a list of tag names separated by comma (as a simple string).
Hi @is-unavco
Piwigo is not expecting the tags to be a JSON encoded string. It could be a possibility: first we check if it's a JSON string, if it is, Piwigo decodes it and it becomes an array as expected.
For now, you can either send an array (not JSON encoded) or a list of tag names separated by comma (as a simple string).
<!-- github-comment-id:1176282126 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I'm using python 3.9 and the requests package to upload images to my Piwigo gallery. I want to associate multiple tags with an image when I upload. My request code looks much like the following:
Doing this leads to erroneous square brackets and quotation marks in the uploaded tag names. See the following image for an example of the incorrect tag names. The tag containing no quotation marks or square brackets is the format I am expecting for all the tags.
Hi @is-unavco
Piwigo is not expecting the tags to be a JSON encoded string. It could be a possibility: first we check if it's a JSON string, if it is, Piwigo decodes it and it becomes an array as expected.
For now, you can either send an array (not JSON encoded) or a list of tag names separated by comma (as a simple string).