WoBike icon indicating copy to clipboard operation
WoBike copied to clipboard

Lime API returns max 50 items, sometimes none

Open Charistoph opened this issue 6 years ago • 2 comments

I'm trying to get a complete list of all scooters in Paris. Here is the code I'm using:

lat = 48.856614
lng = 2.352222

response = requests.get(
        'https://web-production.lime.bike/api/rider/v1/views/map',
        params=[('mobile_registration_id', phone_number),
                ('ne_lat', lat-0.2),
                ('ne_lng', lng-0.2),
                ('sw_lat', lat+0.2),
                ('sw_lng', lng+0.2),
                ('user_latitude', lat),
                ('user_longitude', lng),
                ('zoom', 100)],
        headers={'Accept-Encoding': 'gzip',
                 'Accept-Language': 'en-US',
                 'App-Version': '1.18.1',
                 'Authorization': 'Bearer ' + lime_token,
                 'Connection': 'Keep-Alive',
                 'User-Agent': 'okhttp/3.9.0',
    #              'X-Device-Token': xd_token
                })

The API sometime returns 50 vehicles (seems to be the upper limit) and sometimes none (although I can see that there are scooters in this location in the app).

Has anybody else encountered these issues?

Charistoph avatar Feb 25 '19 17:02 Charistoph

I tested here and seems like there does exist a upper bound.

luyuliu avatar Mar 10 '19 16:03 luyuliu

Hi, in my location (Poland) Lime returns at max 50 vehicles (not necessarily exhausting the amount of vehicles in visible area, just showing closest ones). Also there is a boundary which logic is unclear for me yet, but if in requested area number of bikes is higher then X value (maybe 100?) no vehicles [bikes] are returned, but [bike_clusters] are returned instead.

soo to query all available vehicles in big area i select big area, read [bike_clusters] and check the content of bike_cluster.cluster_text if it is 20+ then single query at bike_cluster.lng bike_cluster.lat with bigger zoom param is enough. if it is 50+ then i split rectangle into sw and ne and make 2 queries with bigger zoom, and ne/se/sw/nw for 100+. That is very cumbersome and i would love to have some 'disable_cluster=true' param but haven't found one ;)

also, @ubahnverleih in Lime.md it is indicated that the 'zoom' param is deterministic of whether we receive clusters or bikes, but it is not that easy and depends on amount of vehicles in given area.

rrozek avatar Aug 13 '19 09:08 rrozek