MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / raw_data

Method raw_data

pogom/app.py:80–135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

78 )
79
80 def raw_data(self):
81 d = {}
82 swLat = request.args.get('swLat')
83 swLng = request.args.get('swLng')
84 neLat = request.args.get('neLat')
85 neLng = request.args.get('neLng')
86 if request.args.get('pokemon', 'true') == 'true':
87 if request.args.get('ids'):
88 ids = [int(x) for x in request.args.get('ids').split(',')]
89 d['pokemons'] = Pokemon.get_active_by_id(ids, swLat, swLng,
90 neLat, neLng)
91 else:
92 d['pokemons'] = Pokemon.get_active(swLat, swLng, neLat, neLng)
93
94 if request.args.get('pokestops', 'true') == 'true':
95 d['pokestops'] = Pokestop.get_stops(swLat, swLng, neLat, neLng)
96
97 if request.args.get('gyms', 'true') == 'true':
98 d['gyms'] = Gym.get_gyms(swLat, swLng, neLat, neLng)
99
100 if request.args.get('scanned', 'true') == 'true':
101 d['scanned'] = ScannedLocation.get_recent(swLat, swLng, neLat,
102 neLng)
103
104 selected_duration = None
105
106 # for stats and changed nest points etc, limit pokemon queried
107 for duration in self.get_valid_stat_input()["duration"]["items"].values():
108 if duration["selected"] == "SELECTED":
109 selected_duration = duration["value"]
110 break
111
112 if request.args.get('seen', 'false') == 'true':
113 d['seen'] = Pokemon.get_seen(selected_duration)
114
115 if request.args.get('appearances', 'false') == 'true':
116 d['appearances'] = Pokemon.get_appearances(request.args.get('pokemonid'), selected_duration)
117
118 if request.args.get('appearancesDetails', 'false') == 'true':
119 d['appearancesTimes'] = Pokemon.get_appearances_times_by_spawnpoint(request.args.get('pokemonid'),
120 request.args.get('spawnpoint_id'),
121 selected_duration)
122
123 if request.args.get('spawnpoints', 'false') == 'true':
124 d['spawnpoints'] = Pokemon.get_spawnpoints(swLat, swLng, neLat, neLng)
125
126 if request.args.get('status', 'false') == 'true':
127 args = get_args()
128 d = {}
129 if args.status_page_password is None:
130 d['error'] = 'Access denied'
131 elif request.args.get('password', None) == args.status_page_password:
132 d['main_workers'] = MainWorker.get_all()
133 d['workers'] = WorkerStatus.get_all()
134
135 return jsonify(d)
136
137 def loc(self):

Callers

nothing calls this directly

Calls 12

get_valid_stat_inputMethod · 0.95
get_argsFunction · 0.90
get_active_by_idMethod · 0.80
get_activeMethod · 0.80
get_stopsMethod · 0.80
get_gymsMethod · 0.80
get_seenMethod · 0.80
get_appearancesMethod · 0.80
get_spawnpointsMethod · 0.80
get_allMethod · 0.80
get_recentMethod · 0.45

Tested by

no test coverage detected