示例#1
0
def create_domain_proofs_index():

    TEST_DOMAIN_VERIFICATIONS = ['muneeb', 'blockstack', 'ryan']

    counter = 0

    for entry in namespace.find(no_cursor_timeout=True):

        if entry['username'] not in TEST_DOMAIN_VERIFICATIONS:
            continue

        profile = json.loads(entry['profile'])

        btc_address = get_btc_address(profile)

        # if no valid btc address, ignore
        if btc_address is None:
            continue

        if 'website' in profile:

            try:
                website_url = profile['website']
            except:
                continue

            print website_url

            domain = website_url.lstrip('https')
            domain = domain.lstrip('://')
            domain = domain.lstrip('www')
            domain = domain.lstrip('.')

            print domain

            proof_txt = get_proof_from_txt_record(domain)

            validProof = contains_valid_proof_statement(
                proof_txt, entry['username'])

            if validProof:

                new_entry = {}
                new_entry['username'] = entry['username']
                new_entry['domain_url'] = domain
                new_entry['profile'] = profile

                check_entry = domain_payment.find_one(
                    {"username": entry['username']})

                if check_entry is not None:
                    print "already in index"
                else:
                    print new_entry
                    domain_payment.save(new_entry)

                    counter += 1
                    print counter
def create_domain_payment_index():

    TEST_DOMAIN_VERIFICATIONS = ["muneeb", "blockstack", "ryan"]

    counter = 0

    for entry in namespace.find(no_cursor_timeout=True):

        if entry["username"] not in TEST_DOMAIN_VERIFICATIONS:
            continue

        profile = json.loads(entry["profile"])

        btc_address = get_btc_address(profile)

        # if no valid btc address, ignore
        if btc_address is None:
            continue

        if "website" in profile:

            try:
                website_url = profile["website"]
            except:
                continue

            print website_url

            domain = website_url.lstrip("https")
            domain = domain.lstrip("://")
            domain = domain.lstrip("www")
            domain = domain.lstrip(".")

            print domain

            proof_txt = get_proof_from_txt_record(domain)

            validProof = contains_valid_proof_statement(proof_txt, entry["username"])

            if validProof:

                new_entry = {}
                new_entry["username"] = entry["username"]
                new_entry["domain_url"] = domain
                new_entry["profile"] = profile

                check_entry = domain_payment.find_one({"username": entry["username"]})

                if check_entry is not None:
                    print "already in index"
                else:
                    print new_entry
                    domain_payment.save(new_entry)

                    counter += 1
                    print counter
示例#3
0
def create_domain_proofs_index():

    TEST_DOMAIN_VERIFICATIONS = ['muneeb', 'blockstack', 'ryan']

    counter = 0

    for entry in namespace.find(no_cursor_timeout=True):

        if entry['username'] not in TEST_DOMAIN_VERIFICATIONS:
            continue

        profile = json.loads(entry['profile'])

        btc_address = get_btc_address(profile)

        # if no valid btc address, ignore
        if btc_address is None:
            continue

        if 'website' in profile:

            try:
                website_url = profile['website']
            except:
                continue

            print website_url

            domain = website_url.lstrip('https')
            domain = domain.lstrip('://')
            domain = domain.lstrip('www')
            domain = domain.lstrip('.')

            print domain

            proof_txt = get_proof_from_txt_record(domain)

            validProof = contains_valid_proof_statement(proof_txt, entry['username'])

            if validProof:

                new_entry = {}
                new_entry['username'] = entry['username']
                new_entry['domain_url'] = domain
                new_entry['profile'] = profile

                check_entry = domain_payment.find_one({"username": entry['username']})

                if check_entry is not None:
                    print "already in index"
                else:
                    print new_entry
                    domain_payment.save(new_entry)

                    counter += 1
                    print counter
    def test_domain_proof(self):
        """ Check domain proof
        """

        for test_domain in test_domains:
            username = test_domain["username"]
            domain = test_domain["domain"]

            proof_txt = get_proof_from_txt_record(domain)

            validProof = contains_valid_proof_statement(proof_txt, username)

            self.assertTrue(validProof)
示例#5
0
    def test_domain_proof(self):
        """ Check domain proof
        """

        for test_domain in test_domains:
            username = test_domain['username']
            domain = test_domain['domain']

            proof_txt = get_proof_from_txt_record(domain)

            validProof = contains_valid_proof_statement(proof_txt, username)

            self.assertTrue(validProof)