@app.route('/announce.php')
def announce():
 ip = request.args.get('ip')
 port = request.args.get('port')
 if ((not ip) or (not port)):
  return abort(404)
 address = (ip, int(port))
 binhash = urlparse.parse_qs(request.query_string)['info_hash'][0]
 country = geoip.country_code_by_addr(ip)
 if (country not in ('CN', 'TW', 'JP', 'HK', 'KR')):
  return abort(404)
 rpc.announce(binhash.encode('hex'), address)
 return bencode({'peers': '', 'interval': 86400})

@ app . route ( '/announce.php' ) def announce ( ) : ip = request . args . get ( 'ip' ) port = request . args . get ( 'port' ) if ( ( not ip ) or ( not port ) ) : return abort ( 404 ) address = ( ip , int ( port ) ) binhash = urlparse . parse_qs ( request . query_string ) [ 'info_hash' ] [ 0 ] country = geoip . country_code_by_addr ( ip ) if ( country not in ( 'CN' , 'TW' , 'JP' , 'HK' , 'KR' ) ) : return abort ( 404 ) rpc . announce ( binhash . encode ( 'hex' ) , address ) return bencode ( { 'peers' : '' , 'interval' : 86400 } )
send an announcement to all channels the bot is in .