theforeman / foreman-documentation

Documentation for the Foreman Project and its ecosystem
https://docs.theforeman.org
Creative Commons Attribution Share Alike 4.0 International
22 stars 95 forks source link

Properly send in params in the Python API example #3406

Open ekohl opened 4 weeks ago

ekohl commented 4 weeks ago

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

Please cherry-pick my commits into:

github-actions[bot] commented 4 weeks ago

The PR preview for 62ab31f398f9980d2ca63fc8dd73963eadb55a10 is available at theforeman-foreman-documentation-preview-pr-3406.surge.sh

The following output files are affected by this PR:

show diff

show diff as HTML