Ejemplo n.º 1
0
Archivo: oss.py Proyecto: hh-h/ossdev
    def POST(self): # noqa
        i = web.input(inp='')
        if not i.inp:
            return dumps({
                'status'    : Status.ERROR,
                'db'        : 'orange'
            })
        log.save_action(session.name, 'ipaddr', 'Поиск в ORANGE {0}'.format(i.inp.encode('utf8')))

        bill = H.check_bill(i.inp)
        ip = None
        if not bill:
            ip = H.check_ip(i.inp)
            if not ip:
                return dumps({
                    'status'    : Status.ERROR,
                    'db'        : 'orange'
                })
            res = ora.get_bill_id_for_ip(ip)

            if res['status'] != Status.SUCCESS:
                return dumps({
                    'status'    : Status.ERROR,
                    'db'        : 'orange'
                })
            bill = res['billid']

        if not bill:
            return dumps({
                'status'    : Status.EMPTY,
                'db'        : 'orange'
            })

        if not H.is_region_allowed(bill, session.regions):
            return dumps({
                'status'    : Status.NOAUTH,
                'db'        : 'orange'
            })

        return ora.get_user_params(bill, ip)