benjhar / JokeAPI-Python

An API Wrapper for Sv443's JokeAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typo in build_request for the Parameter idRange

FGeiselhart opened this issue · comments

Describe the bug
There is a typo within the file main.py on line 160.
When using an IdRange the string 'i&dRange' is appended to the request.
But instead of 'i&dRange' the value '&idRange' needs to be added.
This renders the Range-Feature useless and jokes with random IDs are returned.

To Reproduce
Steps to reproduce the behavior:

  1. Use the optional IdRange Parameter

Expected behavior
The idRange should be applied as a filter. Only jokes that have their IDs within the requested range should be returned.

**Error and/or code snippet **
if id_range:
r += f"i&dRange={id_range[0]}-{id_range[1]}"

Needs to be changed into:
if id_range:
r += f"i&dRange={id_range[0]}-{id_range[1]}"

Thanks very much!

Thank you for the fast fix!

Thanks for making this issue!

No idea how I missed that or how it got past the tests. I'll have to look at them at some point.