foreman-documentation icon indicating copy to clipboard operation
foreman-documentation copied to clipboard

Properly send in params in the Python API example

Open ekohl opened this issue 1 year ago • 1 comments

What changes are you introducing?

Python's requests library accepts a dict with params and then properly encodes this to be sent to a server. This avoids the need to manually encode this in our examples.

Why are you introducing these changes? (Explanation, links to references, issues, etc.)

This fixes a build issue in Red Hat's downstream where Pantheon fails on &, but generally is safer and more understandable code.

Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)

This is an alternative to https://github.com/theforeman/foreman-documentation/pull/3405.

I must admit I haven't tried this on a real system and is solely written based on knowing Python and requests.

Checklists

  • [x] I am okay with my commits getting squashed when you merge this PR.
  • [x] I am familiar with the contributing guidelines.

Please cherry-pick my commits into:

  • [x] Foreman 3.12/Katello 4.14 (Satellite 6.16)
  • [ ] Foreman 3.11/Katello 4.13
  • [ ] Foreman 3.10/Katello 4.12
  • [ ] Foreman 3.9/Katello 4.11 (Satellite 6.15; orcharhino 6.8/6.9/6.10)
  • [ ] Foreman 3.8/Katello 4.10
  • [ ] Foreman 3.7/Katello 4.9 (Satellite 6.14)
  • [ ] Foreman 3.6/Katello 4.8
  • [ ] Foreman 3.5/Katello 4.7 (Satellite 6.13; orcharhino 6.6/6.7)
  • We do not accept PRs for Foreman older than 3.5.

ekohl avatar Oct 31 '24 14:10 ekohl