DMTF/python-redfish-library

Unable to properly construct query parameters

mraineri opened this issue · 1 comments

The current library expects query parameters to be passed into GET requests using the "args" argument. The value passed is a dictionary of each query parameter where the name is the parameter name and the value is parameter argument. Underneath the covers, it calls "urlencode" to process the dictionary to produce the string to append to the URL. For example:

query = { "$filter": "Id eq 'Administrator'" }
filter_resp = redfish_obj.get( "/redfish/v1/AccountService/Roles", args = query )

However, this doesn't get encoded properly; the spaces in the example get encoded as + instead of %20, which makes the parameter argument invalid. There have been issues raised about this, and urlencode can take an optional "quote_via" argument to change the behavior. But since we're using the "six" module for compatibility with Python2, this argument isn't available.

Some options to consider:

  • Do we drop Python2 at this point? Python2 hit EOL January 2020, and many organizations are pledging to drop support for Python2.
  • Do we write our own "urlencode" function for this to maintain Python2 support?

The group currently thinks it's okay to drop Python2. When we do this, we'll need to make it clear in the README, and likely bump the version to 3.0.0. Folks can branch off of the current version if they need to continue with Python2 support.