Closed MvGulik closed 6 years ago
Hmm. This is really awkward to do. It's not clear to me what requests
or urllib3
would do if you gave them an OrderedDict to encode as application/x-www-form-urlencoded
data. I'm not seeing a clear place in the docs stating that order is respected. We might need to do our own encoding. That'd be icky.
I'm not seeing a clear place in the docs stating that order is respected.
Are your referring here to order preservation for/in/with requests
or urllib3
? (I would need to read up on that, if that is the case)
Using an OrderedDict seems to cumbersome to me too (I'm not an expert though).
As far as I see there are just a view cases where the position of some general parameters can matter in mediawiki api calls. Would adding the token parm as separate kw-parm in the final function be a workable option ?
def func(token=None, **rest_parms):
print('-- '+'token', token) ## "-- token 222"
print('-- '+'rest_parms', rest_parms) ## "-- rest_parms {'aaa': 111, 'ccc': 333}"
parms = {'aaa':111, 'token':222, 'ccc':333}
func(**parms)
Although technically this would not be order preserving, but defaulting to a presumed order for some general kw-parameters.
I take it my idea would be the icky one. Closing.
At https://www.mediawiki.org/wiki/API:Edit is says:
Is this "the token should be sent as the last parameter, or at least after the text parameter" supported by python-mwapi ? (bases on a bit of code browsing this seems to be a "no" to me, but I could be wrong)
If 'no', is this something that makes senses to support by python-mwapi ? (for pre https://www.python.org/dev/peps/pep-0468/ supporting python versions that is)