Closed lshw42 closed 3 years ago
Nice! Thanks for the detailed diagnosis. Marking +
as safe for the encoding seems OK to me, or perhaps an even cleaner way would be to allow meta
to be a list (and then build the query string ourselves)? In any case, I'd definitely merge a PR along these lines!
Thank you for your responds. My given solution is something quick-and-dirty, which worked while researching the problem. Making meta
to be a list seem pretty good to me. That way, the representation of the meta
parameter in the later URL is decoupled from input. Also, this would prevent any confusion with the delimiter.
Fixed in #64.
Expected Behaviour
Calling
acoustid.match()
oracoustid.lookup()
with'meta': 'recordings+releasegroups+sources'
leads to a response like the following:Current Behaviour
Calling
acoustid.match()
oracoustid.lookup()
with'meta': 'recordings+releasegroups+sources'
leads to a response like the following:Steps to Reproduce
pyacoustid
Please replace
<path>
and<apikey>
accordingly.Context (Environment
Python 3.8.10 (default, Jun 2 2021, 10:49:15) pyacoustid 1.2.0
Detailed Description
response = session.post(url, data=params, headers=headers, timeout=timeout)
does url-encodeparams
which leads to the problem, that'meta': 'recordings+releasegroups+sources'
becomesmeta=recordings%2Breleasegroups%2Bsources
instead ofmeta=recordings+releasegroups+sources
. This breaks the AcoustID Web Service and it ignores themeta
parameter.Possible Implementation
To solve this safe the
+
by using e.g.urllib.parse.urlencode(params, safe='+')
.