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

Update geocoder_api.py #77

Merged
merged 3 commits into from
May 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions herepy/geocoder_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def address_with_boundingbox(

def address_with_details(
self,
house_number: int,
street: str,
house_number: Optional[int] = None,
street: Optional[str] = None,
Copy link
Owner

Choose a reason for hiding this comment

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

Add the optional parameters after the required parameters to fix the linting issues

city: str,
country: str,
lang: str = "en-US",
Expand All @@ -129,11 +129,16 @@ def address_with_details(
Raises:
HEREError"""

qq_query = ""
if house_number is not None:
qq_query += f"houseNumber={house_number};"
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add new test cases to cover the optional parameters?

if street is not None:
qq_query += f"street={street};"
Copy link
Owner

Choose a reason for hiding this comment

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

Same here

qq_query += f"city={city};"
qq_query += f"country={country}"

data = {
"qq": str.format("houseNumber={0};", house_number)
+ str.format("street={0};", street)
+ str.format("city={0};", city)
+ str.format("country={0}", country),
"qq": qq_query,
"apiKey": self._api_key,
"lang": lang,
}
Expand Down
Loading