This Python script and documentation provide a threaded approach for making HTTP requests to a list of URLs, analyzing response data, finding attribute occurrences, and calculating rarity based on a collection size.
-
Make sure you have Python 3.x installed.
-
Install the required Python packages using pip:
pip install requests psutil- Clone or download this repository to your local machine.
You can use the provided Python script threaded_url_requests.py for multi-threaded URL requests and data analysis. The script includes a class ThreadRequests and three main functions for different tasks:
get_data(urls_list: list): Fetches data from a list of URLs.get_occurrence_data(urls_list: list): Fetches data and finds attribute occurrences.get_rarity_data(urls_list: list, collection_size): Fetches data, finds attribute occurrences, and calculates rarity.
Here's how to run these functions:
# Example usage
import threaded_url_requests
# List of URLs to fetch data from
urls_list = [...]
collection_size = 20 # Set your collection size
# Fetch data from URLs
attribute_list = threaded_url_requests.get_data(urls_list)
# Find attribute occurrences
occurrence_data = threaded_url_requests.get_occurrence_data(urls_list)
# Calculate rarity
rarity_data = threaded_url_requests.get_rarity_data(urls_list, collection_size)Detailed documentation for the provided Python script threaded_url_requests.py:
- Class
ThreadRequests: A class for handling multi-threaded URL requests and data analysis. - Methods:
run,check_status,worker_get,find_occurrence,get_occurrence,calculate_rarity, and more. - Properties:
responses. - Function
get_data(urls_list): Fetches data from a list of URLs using multi-threaded requests. - Function
get_occurrence_data(urls_list): Fetches data and finds attribute occurrences from a list of URLs using multi-threaded requests. - Function
get_rarity_data(urls_list, collection_size): Fetches data, finds attribute occurrences, and calculates rarity from a list of URLs using multi-threaded requests.
This project is licensed under the MIT License
Yasir Ali
LinkedIn:\yasirali179