+ context.response = SearchResponse(outp, outfmt, status)
+
+@when(u'sending (?P<fmt>\S+ )?reverse coordinates (?P<lat>.+)?,(?P<lon>.+)?')
+def website_reverse_request(context, fmt, lat, lon):
+ params = {}
+ if lat is not None:
+ params['lat'] = lat
+ if lon is not None:
+ params['lon'] = lon
+
+ outp, status = send_api_query('reverse', params, fmt, context)
+
+ if fmt is None:
+ outfmt = 'xml'
+ elif fmt == 'jsonv2 ':
+ outfmt = 'json'
+ else:
+ outfmt = fmt.strip()
+
+ context.response = ReverseResponse(outp, outfmt, status)
+
+@when(u'sending (?P<fmt>\S+ )?details query for (?P<query>.*)')
+def website_details_request(context, fmt, query):
+ params = {}
+ if query[0] in 'NWR':
+ params['osmtype'] = query[0]
+ params['osmid'] = query[1:]
+ else:
+ params['place_id'] = query
+ outp, status = send_api_query('details', params, fmt, context)
+
+ if fmt is None:
+ outfmt = 'html'
+ else:
+ outfmt = fmt.strip()
+
+ context.response = DetailsResponse(outp, outfmt, status)
+
+@when(u'sending (?P<fmt>\S+ )?lookup query for (?P<query>.*)')
+def website_lookup_request(context, fmt, query):
+ params = { 'osm_ids' : query }
+ outp, status = send_api_query('lookup', params, fmt, context)
+
+ if fmt == 'json ':
+ outfmt = 'json'
+ elif fmt == 'geojson ':
+ outfmt = 'geojson'
+ else:
+ outfmt = 'xml'
+
+ context.response = SearchResponse(outp, outfmt, status)
+
+@when(u'sending (?P<fmt>\S+ )?status query')
+def website_status_request(context, fmt):
+ params = {}
+ outp, status = send_api_query('status', params, fmt, context)
+
+ if fmt is None:
+ outfmt = 'text'
+ else:
+ outfmt = fmt.strip()