api.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:DadosBicicletar 作者: paoloo 项目源码 文件源码
def getStations(self, busca=''):
        print
        response.headers['Access-Control-Allow-Origin']='*'
        response.headers['Content-Type']='application/json'
        _estacoes = self._g._get() if busca == '' else self._g._busca(busca)
        _bloco = []
        for _estacao in _estacoes:
            _nome, _lat, _long, _endereco, _linha, _statusOnline, _StatusOperacional, _disp1, _disp2, _total, _internalStatus, _img, _id = _estacao
            _bloco.append({ "type" : "Feature",
                            "geometry" : {
                                "coordinates": [ _long, _lat ],
                                "type": "Point" },
                            "properties": {
                                "id" : _id,
                                "nome" : _nome,
                                "endereco" : _endereco,
                                "estacao" : _linha,
                                "status_online": _statusOnline,
                                "status_operacional" : _StatusOperacional,
                                "qtd_bikes_disp_1" : _disp1,
                                "qtd_bikes_disp_2" : _disp2,
                                "qtd_vagas_total" : _total,
                                "statusInterno" : _internalStatus }
                         })
        return json.dumps({ "features" : _bloco, "type": "FeatureCollection" }, indent=2, sort_keys=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号