Skip to content

Commit ab0f957

Browse files
committed
add converter for data.lime.bike
1 parent 3463c98 commit ab0f957

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-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,32 @@
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 path.endswith('/gbfs.json') or not isinstance(data, dict) or not isinstance(data.get('data'), dict):
17+
return data
18+
19+
for language in data['data']:
20+
new_feeds = []
21+
if not isinstance(data['data'][language].get('feeds'), list):
22+
continue
23+
24+
for feed in data['data'][language]['feeds']:
25+
if not isinstance(feed, dict) or feed.get('name') in ['station_information', 'station_status']:
26+
continue
27+
28+
new_feeds.append(feed)
29+
30+
data['data'][language]['feeds'] = new_feeds
31+
32+
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)