Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix route v8 multiple via points #76

Merged
merged 6 commits into from
Mar 31, 2024

Conversation

cecileprat
Copy link

Regarding route_v8 and the use of via parameter:

When adding more than 10 via points, the last ones are ignored.

It comes from the fact that in that case, some keys_for_manipulation are substrings of others (ex: "via1" and "via10").
When you replace the first one in the url, it also replaces a part of the second one, and so the replace does not work as expected (you end up with a via0= in the final url)

I just ensured that first keys can not be substrings of last ones.

@@ -448,7 +448,7 @@ def route_v8(
via_keys = []
if via:
for i, v in enumerate(via):
key = str.format("{0}{1}", "via", i)
key = str.format("{0}{1}_", "via", i)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of using _ here?

Copy link
Author

@cecileprat cecileprat Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have 11 via points, you will have via1 and via10 in data and manipulation_keys

The first url built in __get will contain: via1=...&via10=..

Then we loop to replace those manipulation_keys (via1 and via10) by the one needed by HERE (via):

  • url.replace("via1", "via") -> via=...&via0=... (it also replaces the first part of via10)
  • url.replace("via10", "via") -> via=...&via0=... (it does nothing, so the second via point is not given through the via query parameter, and so HERE does not take the second via point into account)

By creating via1_ and via10_ keys instead:

given the url containing via1_=...&via10_=..

  • url.replace("via1_", "via") -> via=...&via10_=... (it replaces only the first key)
  • url.replace("via10_", "via") -> via=...&via=... (it replaces the second key)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification 👍 changes look good to me.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind bumping the version of codecov to make the CI happy?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bumping the codecov version, it seems like your test is failing. Let's fix it and then we can merge.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Responses requires Python 3.8 or higher as I see, can you remove the previous versions from CI config?

Copy link
Author

@cecileprat cecileprat Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want me to remove it from ci.yml and .travis.yml, but keep python_requires=">=3.5" in setup.py?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please, 3.5 has already reached end of life. It's a good time to stop supporting it. Please update the setup.py too.

@abdullahselek abdullahselek merged commit 5e6b9ac into abdullahselek:master Mar 31, 2024
15 of 16 checks passed
@cecileprat
Copy link
Author

cecileprat commented Apr 2, 2024

It looks like the merge has failed and the fix is not part of the last release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants