Skip to main content

Tranco: A Research-Oriented Top Sites Ranking Hardened Against Manipulation

Project description

Tranco

This package allows easy access to the Tranco list, published at https://tranco-list.eu.

Usage

Create a Tranco object, indicating whether you want to cache downloaded lists:

from tranco import Tranco
t = Tranco(cache=True, cache_dir='.tranco')

You can then retrieve lists from this object using the list method:

latest_list = t.list()
date_list = t.list(date='2019-02-25')

This method returns a TrancoList, which allows you to retrieve a certain prefix of the list (top), the list ID (list_id), the list page (list_page) or the rank of a domain (rank):

latest_list.top(10000)
latest_list.list_id
latest_list.list_page
latest_list.rank("google.com")
latest_list.rank("not.in.ranking") # returns -1

You can also generate custom lists. First, create a Tranco object with valid credentials (available from your account page):

from tranco import Tranco
t = Tranco(account_email="abc@xyz.eu", api_key="123ABC")

Then, pass the configuration (according to this schema) of your custom list to configure:

c = t.configure(
    {
        'providers': ['alexa', 'umbrella', 'majestic'],
        'startDate': '2021-01-01',
        'endDate': '2021-01-30',
        'combinationMethod': 'dowdall',
        'listPrefix': 'full',
        'filterPLD': 'on',
    }
)

This method returns a tuple: whether the list is already available or is still being generated, and the ID that has been/will be assigned to the list.

You can retrieve metadata for a list through list_metadata:

m = t.list_metadata(list_id="6P7X")

If a list is still being generated, you can use this method to track the progress; once a list has been generated, this metadata will indicate how the list was configured.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tranco, version 0.6
Filename, size File type Python version Upload date Hashes
Filename, size tranco-0.6-py3-none-any.whl (5.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tranco-0.6.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page