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

Multiple avoid problems #382

Open
tpchris1 opened this issue Sep 19, 2020 · 1 comment · May be fixed by #417
Open

Multiple avoid problems #382

tpchris1 opened this issue Sep 19, 2020 · 1 comment · May be fixed by #417
Assignees
Labels
help wanted We'd love to have community involvement on this issue. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tpchris1
Copy link

Problem

When I passed the avoid parameters in the distance_matrix method, it told me that it is an invalid restriction. However, I wonder if it's possible to allow multiple avoid options like avoid=tolls|highways|ferries.
Thank you!

Environment details

  1. API: Distance_Matrix
  2. Win 10 v2004
  3. lib version: 4.4.2, Jupyter Notebook

Steps to reproduce

  1. Simply add multiple avoids in the distance_matrix parameter

Code example

# example
gmaps = googlemaps.Client(key=YOUR_KEY)
gmaps.distance_matrix(origins=SOMEPLACE,destinations=SOMEPLACE, mode='driving', avoid='tolls|highways|ferries')

Stack trace

# example
D:\Program_Files\Anaconda3\lib\site-packages\googlemaps\distance_matrix.py in distance_matrix(client, origins, destinations, mode, language, avoid, units, departure_time, arrival_time, transit_mode, transit_routing_preference, traffic_model, region)
    107     if avoid:
    108         if avoid not in ["tolls", "highways", "ferries"]:
--> 109             raise ValueError("Invalid route restriction.")
    110         params["avoid"] = avoid
    111 

ValueError: Invalid route restriction.
@tpchris1 tpchris1 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 19, 2020
@jpoehnelt jpoehnelt added help wanted We'd love to have community involvement on this issue. priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels Jan 28, 2021
@shaiguelman shaiguelman linked a pull request Sep 6, 2021 that will close this issue
Yakopoto pushed a commit to Yakopoto/google-maps-services-python that referenced this issue Oct 4, 2021
@jpoehnelt jpoehnelt removed their assignment Jan 18, 2023
@wangela wangela self-assigned this Jan 25, 2023
@wangela
Copy link
Member

wangela commented Jan 25, 2023

I've confirmed that multiple arguments are supported by Distance Matrix API, just as they are with Directions API. Getting the documentation updated to reflect that.

I've left some review comments in #417 to hopefully get that merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We'd love to have community involvement on this issue. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants