inventree / inventree-python

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

Extra kwargs in some function definitions? #158

Closed miggland closed 1 year ago

miggland commented 1 year ago

If you could confirm that I'm correct in my interpretation here:

Extra kwargs, which should not be sent: https://github.com/inventree/inventree-python/blob/d13d8af985fa9d5321ddd6f85c693ded2d6c5d2b/inventree/base.py#L161 since the kwargs are put in the params variable a few lines before: https://github.com/inventree/inventree-python/blob/d13d8af985fa9d5321ddd6f85c693ded2d6c5d2b/inventree/base.py#L156

Same thing here: https://github.com/inventree/inventree-python/blob/d13d8af985fa9d5321ddd6f85c693ded2d6c5d2b/inventree/base.py#L183 following on https://github.com/inventree/inventree-python/blob/d13d8af985fa9d5321ddd6f85c693ded2d6c5d2b/inventree/base.py#L175

SchrodingersGat commented 1 year ago

@miggland you're right this looks strange. I think that probably params=params should be removed from all instances?

miggland commented 1 year ago

Hmm.. the get function for example doesn't do the translation to the params variable though.. it just forwards all kwargs.

Shouldn't eg line 183 be changed from response = api.get(url=url, params=params, **kwargs) to response = api.get(url=url, params=params)

Also, the check if URL is in kwargs should be before kwargs are assigned to params, or is this required later on?

Maybe I should make a PR and test this out..