Skip to content

Commit e09bfca

Browse files
committed
add converter for data.lime.bike
1 parent 12d16d9 commit e09bfca

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
The changelog lists relevant feature changes between each release. Search GitHub issues and pull requests for smaller issues.
4+
5+
## Upcoming release (under development)
6+
7+
## 2024-06-14
8+
- add converter for `data.lime.bike` feed: remove `station_status` and `station_information` feeds from gbfs.json, as Lime associates all free floating bikes to a single station, which is semantically wrong.
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
MobiData BW Proxy
3+
Copyright (c) 2023, binary butterfly GmbH
4+
All rights reserved.
5+
"""
6+
7+
from typing import List, Union
8+
9+
from app.base_converter import BaseConverter
10+
11+
12+
class GbfsLimeRemoveStationsConverter(BaseConverter):
13+
hostnames = ['data.lime.bike']
14+
15+
def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
16+
if not isinstance(data, dict) and not path.endswith('/gbfs.json'):
17+
return data
18+
19+
if not isinstance(data, dict) or 'data' not in data or not isinstance(data['data'], dict):
20+
return data
21+
22+
for language in data['data']:
23+
new_feeds = []
24+
if 'feeds' not in data['data'][language] or not isinstance(data['data'][language]['feeds'], list):
25+
continue
26+
27+
for feed in data['data'][language]['feeds']:
28+
if not isinstance(feed, dict) or 'name' not in feed or feed['name'] in ['station_information', 'station_status']:
29+
continue
30+
31+
new_feeds.append(feed)
32+
33+
data['data'][language]['feeds'] = new_feeds
34+
35+
return data

config_dist_dev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ HTTP_TO_HTTPS_HOSTS:
33
- gbfs.nextbike.net
44
- apis.deutschebahn.com
55
- stables.donkey.bike
6+
- data.lime.bike

0 commit comments

Comments
 (0)