Skip to content

Commit eb9c177

Browse files
committed
Added support for exclude_ireland option
1 parent ca4da37 commit eb9c177

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

geouk/resources.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,40 @@ def random(cls, client, lat, lon, d):
6969
return None
7070

7171
@classmethod
72-
def search(cls, client, q):
72+
def search(cls, client, q, exclude_ireland=False):
7373
"""
7474
Fetch a list of places that match the given query string.
7575
"""
7676

77+
params = {'q': q}
78+
if exclude_ireland:
79+
params['exclude_ireland'] = True
80+
7781
# Fetch the matching places
7882
r = client(
7983
'get',
8084
'places/search',
81-
params={'q': q}
85+
params=params
8286
)
8387

8488
return [cls(client, p) for p in r]
8589

8690
@classmethod
87-
def typeahead(cls, client, q):
91+
def typeahead(cls, client, q, exclude_ireland=False):
8892
"""
8993
Return a list of place names and postcodes starting with the query
9094
string's first 2 characters
9195
"""
9296

97+
params = {'q': q}
98+
if exclude_ireland:
99+
params['exclude_ireland'] = True
100+
93101
# Fetch the typeahead results
94102
r = client(
95103
'get',
96104
'places/typeahead',
97-
params={'q': q}
105+
params=params
98106
)
99107

100108
return r

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Versions should comply with PEP440. For a discussion on single-sourcing
2222
# the version across setup.py and the project code, see
2323
# https://packaging.python.org/en/latest/single_source_version.html
24-
version='0.0.5',
24+
version='0.0.6',
2525
description=(
2626
'The GeoUK Python library provides a pythonic interface to the GeoUK '
2727
'API.',

0 commit comments

Comments
 (0)