Esempio n. 1
0
def getlogin():
    # form = request.args
    # form = request.form
    # 用类函数来判断
    # u = User.register(form)
    basehref = get_href()
    return render_template("login.html", basehref=basehref)
Esempio n. 2
0
def print_dns(client, name):
    for server in client.servers.list():
        if server.name != name: continue
        ip4 = utils.get_public_ip(server)
        ip6 = utils.get_public_ip(server, 6)
        href = utils.get_href(server)

        print
        print "Run the following commands to set up DNS:"
        print
        print ". ~root/rackdns-venv/bin/activate"
        print
        print(
            "rackdns rdns-create --name %s \\\n"
            "    --data %s \\\n"
            "    --server-href %s \\\n"
            "    --ttl 3600" % (server.name, ip6, href))
        print
        print(
            "rackdns rdns-create --name %s \\\n"
            "    --data %s \\\n"
            "    --server-href %s \\\n"
            "    --ttl 3600" % (server.name, ip4, href))
        print
        print ". ~root/ci-launch/openstack-rs-nova.sh"
        print
        print(
            "rackdns record-create --name %s \\\n"
            "    --type AAAA --data %s \\\n"
            "    --ttl 3600 openstack.org" % (server.name, ip6))
        print
        print(
            "rackdns record-create --name %s \\\n"
            "    --type A --data %s \\\n"
            "    --ttl 3600 openstack.org" % (server.name, ip4))
Esempio n. 3
0
def print_dns(client, name):
    for server in client.servers.list():
        if server.name != name: continue
        ip4 = utils.get_public_ip(server)
        ip6 = utils.get_public_ip(server, 6)
        href = utils.get_href(server)

        print
        print "Run the following commands to set up DNS:"
        print
        print ". ~root/rackdns-venv/bin/activate"
        print
        print ("rackdns rdns-create --name %s \\\n"
               "    --data %s \\\n"
               "    --server-href %s \\\n"
               "    --ttl 3600" % (
                server.name, ip6, href))
        print
        print ("rackdns rdns-create --name %s \\\n"
               "    --data %s \\\n"
               "    --server-href %s \\\n"
               "    --ttl 3600" % (
                server.name, ip4, href))
        print
        print ". ~root/ci-launch/openstack-rs-nova.sh"
        print
        print ("rackdns record-create --name %s \\\n"
               "    --type AAAA --data %s \\\n"
               "    --ttl 3600 openstack.org" % (
                server.name, ip6))
        print
        print ("rackdns record-create --name %s \\\n"
               "    --type A --data %s \\\n"
               "    --ttl 3600 openstack.org" % (
                server.name, ip4))
Esempio n. 4
0
def get_ticker_data(ticker):
    url = get_ticker_url(ticker)
    print(url)
    page = urllib.request.urlopen(url)
    soup = BS(page.read(), "lxml")
    # Attempt to find table
    table = soup.find('table', {'class': 'tableFile2'})
    if table is None:
        print('Invalid ticker: ' + ticker)
        return

    for row in table.find_all('tr'):
        cells = row.find_all('td')
        if len(cells) == 5:
            if cells[0].text.strip() == _form:
                # this is a form of type 10-K
                filedate = format_cell(cells[3])
                if not valid_year(filedate):
                    continue
                pretty_filedate = filedate.replace('-', '_')
                # descr = format_cell(cells[2])
                endpoint = cells[1].find('a', {'id': 'documentsbutton'})
                link = get_href(endpoint)
                get_10k_data(link, [ticker, pretty_filedate])
Esempio n. 5
0
def print_dns(client, name, dns_tool):
    for server in client.servers.list():
        if server.name != name: continue
        domain = server.name.split('.', 1)[1]
        ip4 = utils.get_public_ip(server)
        ip6 = utils.get_public_ip(server, 6)
        href = utils.get_href(server)

        print
        print "Run the following commands to set up DNS:"
        print
        print ". ~root/rackdns-venv/bin/activate"
        print
        print(
            "%s rdns-create --name %s \\\n"
            "    --data %s \\\n"
            "    --server-href %s \\\n"
            "    --ttl 3600 %s" % (dns_tool, server.name, ip6, href, domain))
        print
        print(
            "%s rdns-create --name %s \\\n"
            "    --data %s \\\n"
            "    --server-href %s \\\n"
            "    --ttl 3600 %s" % (dns_tool, server.name, ip4, href, domain))
        print
        print ". ~root/ci-launch/openstack-rs-nova.sh"
        print
        print(
            "%s record-create --name %s \\\n"
            "    --type AAAA --data %s \\\n"
            "    --ttl 3600 %s" % (dns_tool, server.name, ip6, domain))
        print
        print(
            "%s record-create --name %s \\\n"
            "    --type A --data %s \\\n"
            "    --ttl 3600 %s" % (dns_tool, server.name, ip4, domain))
Esempio n. 6
0
def print_dns(client, name, dns_tool):
    for server in client.servers.list():
        if server.name != name: continue
        domain = server.name.split('.', 1)[1]
        ip4 = utils.get_public_ip(server)
        ip6 = utils.get_public_ip(server, 6)
        href = utils.get_href(server)

        print
        print "Run the following commands to set up DNS:"
        print
        print ". ~root/rackdns-venv/bin/activate"
        print
        print ("%s rdns-create --name %s \\\n"
               "    --data %s \\\n"
               "    --server-href %s \\\n"
               "    --ttl 3600 %s" % (
                dns_tool, server.name, ip6, href, domain))
        print
        print ("%s rdns-create --name %s \\\n"
               "    --data %s \\\n"
               "    --server-href %s \\\n"
               "    --ttl 3600 %s" % (
                dns_tool, server.name, ip4, href, domain))
        print
        print ". ~root/ci-launch/openstack-rs-nova.sh"
        print
        print ("%s record-create --name %s \\\n"
               "    --type AAAA --data %s \\\n"
               "    --ttl 3600 %s" % (
                dns_tool, server.name, ip6, domain))
        print
        print ("%s record-create --name %s \\\n"
               "    --type A --data %s \\\n"
               "    --ttl 3600 %s" % (
                dns_tool, server.name, ip4, domain))