rubenvereecken / pokemongo-api

Pokemon Go API for Python
Other
358 stars 120 forks source link

[Request] Gym info method #14

Closed legz closed 8 years ago

legz commented 8 years ago

It would be nice to have a method to get info on a specific gym. The id, latitude, longitude, ownership, and gym points are included in getMapObjects() so, is there any way to have :

Thanks for this great work!

dmadisetti commented 8 years ago

Just merged in get details . Example https://github.com/rubenvereecken/pokemongo-api/blob/master/pogo/demo.py#L116

fort_id: "75d4bf3689164d25bb91158ad436c11d.16"
name: "Samba Woman"
image_urls: "http://lh4.ggpht.com/LJWbMFQJ67XzEg2DeEcmfS8FmXWPWlwhdd3aABYUf9RAWFCaeLkJGK_1tk2tm1ZFfDb0neNJA53VQK5JGSmulA"
type: CHECKPOINT
latitude: 37.775522
longitude: -122.419064
description: "\"The woman who thought she was more than a Samba rode underground trains dressed up for dancing,  as usual. \""
legz commented 8 years ago

@dmadisetti Thanks, but getFortDetails() 'only' get the name, description and picture. Pokémons details could be very usefull.

dmadisetti commented 8 years ago

? I don't think that's true. It gets pokemon details as well. Both Pokestops and Gyms are considered "Forts". I posted a Pokestop response, but gym responses will have more.

message FortDetailsResponse {
    string fort_id = 1;
    .POGOProtos.Enums.TeamColor team_color = 2;
    .POGOProtos.Data.PokemonData pokemon_data = 3;
    string name = 4;
    repeated string image_urls = 5;
    int32 fp = 6;
    int32 stamina = 7;
    int32 max_stamina = 8;
    .POGOProtos.Map.Fort.FortType type = 9;
    double latitude = 10;
    double longitude = 11;
    string description = 12;
    repeated .POGOProtos.Map.Fort.FortModifier modifiers = 13;
}
legz commented 8 years ago

You are maybe right, but I don't know how to get such details. I tried this:

def ListGyms(session):
    cells = session.getMapObjects()
    latitude, longitude, _ = session.getCoordinates()
    for cell in cells.map_cells:
        for fort in cell.forts:
            if fort.type != 1:
                fortDetails = session.getFortDetails(fort)
                print fortDetails

And I get this:

fort_id: "76b18c9065c64ac497ea3a7d59bbbc0c.12"
name: "Statue D\' Henri IV"
image_urls: "http://www.panoramio.com/photos/small/2996280.jpg"
latitude: 48.857129
longitude: 2.341039

fort_id: "c42345d1ecb24d4f8422a65299a8e1cc.16"
name: "Atelier d\'artistes"
image_urls: "http://lh3.googleusercontent.com/Vl7ExCF0CvyrpTRsmXvgTaTeGbvWXjGFma7DyBpwfVPDhk2u6mtimWWfEG76hWaN8khNCgGDADOql_Oir54"
latitude: 48.859226
longitude: 2.345691
...

Is there a mistake?

dmadisetti commented 8 years ago

Yeah fort.type == 1 filters only pokestops

Remove the if

dmadisetti commented 8 years ago

@legz Modifiers are also available. EG:

modifiers {
  item_id: ITEM_TROY_DISK
  expiration_timestamp_ms: 1469375398904
  deployer_player_codename: "SaenzD"
}

Shows a lure

legz commented 8 years ago

Yep, fort.type == 1 is for pokéstops, that why I set fort.type != 1 ;)

legz commented 8 years ago

I tried again with the latest master version and there is still nothing for gyms. Here are some logs for getFortDetails() on both pokéstops and gyms

Line 183,demo.py - 2016-07-28 20:07:33,533 - INFO - Details :
fort_id: "2c1c79c2f61c44408f3d1b9e4510f96f.16"
name: "Death Monument"
image_urls: "http://lh5.ggpht.com/Rb6cV3Yr2_45WzejeCpt8muXuXup57UYjGU6kNMaNp17OMOPwiUCKRp_yHE7pUC0sU5ycpiLmn7eKEUr8uuv"
type: CHECKPOINT
latitude: 45.805723
longitude: 4.62333
description: "The death monument dedicated to the dead people of 1914-1918 and 1939-1945.\n"

Line 183,demo.py - 2016-07-28 20:07:33,661 - INFO - Details :
fort_id: "bcba8ad4590a4a3489d9761986206ad0.16"
name: "Church of Sourcieux Les Mines"
image_urls: "http://lh5.ggpht.com/It_f_bA9ghVYW0D-k7EUDwCDYMM9RF9m2Tps8bSyPH9Ww8wlw3TItg22jbgW9v26BAe6O9aF52lM23-Z0V-i"
latitude: 45.805198
longitude: 4.623265

Line 183,demo.py - 2016-07-28 20:07:34,065 - INFO - Details : 
fort_id: "52df9a2861cf403d877635337b1f7d57.16"
name: "Christian Cross"
image_urls: "http://lh4.ggpht.com/D5HZeK5QO42a__4jlYfAv38FQQuJHlqpzFTsk4RhOP6xLaFMvwADGRGiTfPO5Ut5-Hah_QjyREYn_Y90m40"
type: CHECKPOINT
latitude: 45.805327
longitude: 4.625082

Line 183,demo.py - 2016-07-28 20:07:34,192 - INFO - Details :
fort_id: "3f1f21dd3e684455860ede7e5bd2c78d.16"
name: "Chapelle"
image_urls: "http://lh3.ggpht.com/zdWDIRe4yPs5SM4x_i9TmASlsPUy1myeHOIUDs-mRkFnzfi75M741v4yqyLuQISuKaXS50ZPqIc6rmu8S7U"
latitude: 45.809014
longitude: 4.630497

Line 183,demo.py - 2016-07-28 20:07:34,319 - INFO - Details :
fort_id: "4954a303d5654962adf5a6325e4b13c6.16"
name: "Louise Marechal\'s Cross"
image_urls: "http://lh3.ggpht.com/oa8WQ_i0VIAYxCbmIllvceX9WJ8WFi4gtE-WDMEUqLwbiZgN_g-zD5ICjgt9-xIHWkBIkZog6FpoSNZX784"
type: CHECKPOINT
latitude: 45.806947
longitude: 4.630118

As you can see, pokéstops have a type: CHECKPOINT ans gyms haven't really more information.

@dmadisetti could you give me a hint on how to get the complete information for a gym through the API please?

smartcuc commented 8 years ago

Please can someone get me up to speed and share the code for getting the details?