flashlight package

Submodules

flashlight.ahmia module

flashlight.ahmia.get_banned(from_cache=True) list[str]

get hash set of banned .onion sites from ahmia.fi.

Parameters:

from_cache – whether to use cached result or not, defaults to True

Returns:

hash set of banned .onion sites

Return type:

list[str]

flashlight.blockchain module

class flashlight.blockchain.BalanceInfo(address: str, confirmed: int, received: int, txs: int, unconfirmed: int, utxo: int)

Bases: object

data class representing balance information of a bitcoin address.

address: str
confirmed: int
received: int
txs: int
unconfirmed: int
utxo: int
flashlight.blockchain.get_balance_info(address: str) BalanceInfo

get balance info of a bitcoin address.

Parameters:

address (str) – bitcoin address

Returns:

balance info of the address

Return type:

BalanceInfo

flashlight.blockchain.get_tx_ids(address: str) set[str]

get transaction ids of a bitcoin address.

Parameters:

address (str) – bitcoin address

Returns:

set of transaction ids

Return type:

set[str]

flashlight.blockchain.get_tx_info(tx_id: str) dict

get transaction info by a bitcoin transaction id.

Parameters:

tx_id (str) – bitcoin transaction id

Returns:

transaction info

Return type:

dict

flashlight.blockchain.get_tx_infos(*tx_id) Iterable[dict]

get transaction info by a bitcoin transaction id.

Parameters:

tx_id – bitcoin transaction id

Returns:

transaction info

Return type:

Iterable[dict]

flashlight.checkitonion module

class flashlight.checkitonion.CheckItOnion

Bases: object

class to scrape checkitonion.online to retrieve top .onion websites.

HEADERS = {'user-agent': 'Mozilla/5.0'}
URL = 'https://checkitonion.online/'
refresh()

refresh the list of top websites from checkitonion.online

Parameters:

self – The instance of the class.

property topsites: list[flashlight.checkitonion.Website]

get the list of top websites.

Parameters:

self – The instance of the class.

Returns:

list of top websites.

Return type:

list[Website]

class flashlight.checkitonion.Website(title: str, url: str, is_running: bool)

Bases: object

data class representing a website with its title, URL, and running status.

is_running: bool
title: str
url: str

flashlight.model module

flashlight.model.is_nsfw(raw: bytes) bool

classify an image as NSFW or not.

Parameters:

raw (bytes) – raw image bytes to be classified

Returns:

True if the image is classified as NSFW with high confidence, False otherwise

Return type:

bool

flashlight.scrapper module

flashlight.scrapper.get_image_srcs(url: str) Generator[str, None, None]

get image src links from a given url.

Parameters:

url (str) – target url

Returns:

generator of image src links

Return type:

Generator[str, None, None]

get .onion links from html content.

Parameters:

html (str) – html content

Returns:

generator of .onion links

Return type:

Generator[str, None, None]

flashlight.scrapper.traverse_hrefs(start_url: str) Generator[tuple[str, bs4.BeautifulSoup], None, None]

traverse href links starting from start_url.

Parameters:

start_url (str) – starting url

Returns:

generator of tuples of url and BeautifulSoup object

Return type:

Generator[tuple[str, BeautifulSoup], None, None]

Module contents