parascode
Advanced tools
| Metadata-Version: 2.4 | ||
| Name: parascode | ||
| Version: 0.2.0 | ||
| Version: 1.1.2 | ||
| Summary: Multi functional python module | ||
| Author: Paras |
+90
-71
@@ -15,3 +15,3 @@ """ | ||
| __version__ = "0.2.0" | ||
| __version__ = "1.1.2" | ||
@@ -21,30 +21,29 @@ | ||
| colors = { | ||
| "red": "\033[91m", | ||
| "green": "\033[92m", | ||
| "yellow": "\033[93m", | ||
| "blue": "\033[94m", | ||
| "purple": "\033[95m", | ||
| "cyan": "\033[96m", | ||
| "white": "\033[97m", | ||
| "bold": "\033[1m", | ||
| "reset": "\033[0m" | ||
| } | ||
| def __init__(self): | ||
| self.colors = { | ||
| 'red': '\033[91m', | ||
| 'green': '\033[92m', | ||
| 'yellow': '\033[93m', | ||
| 'blue': '\033[94m', | ||
| 'purple': '\033[95m', | ||
| 'cyan': '\033[96m', | ||
| 'white': '\033[97m', | ||
| 'reset': '\033[0m', | ||
| 'bold': '\033[1m', | ||
| } | ||
| # ---------------------- | ||
| # COLOR PRINT SYSTEM | ||
| # ---------------------- | ||
| # Random utilities | ||
| def print(self, text): | ||
| for c in self.colors: | ||
| text = text.replace(c, self.colors[c]) | ||
| print(text + self.colors["reset"]) | ||
| def random_user_agent(self): | ||
| agents = [ | ||
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0', | ||
| 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/120.0.0.0', | ||
| 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Mobile', | ||
| 'Mozilla/5.0 (Linux; Android 13) Chrome/120.0.0.0 Mobile', | ||
| ] | ||
| return random.choice(agents) | ||
| # ---------------------- | ||
| # RANDOM TOOLS | ||
| # ---------------------- | ||
| def random_string(self, length=10): | ||
| chars = string.ascii_letters + string.digits | ||
| return ''.join(random.choice(chars) for _ in range(length)) | ||
| return ''.join(random.choices(chars, k=length)) | ||
@@ -54,72 +53,92 @@ def random_number(self, start=1000, end=9999): | ||
| def random_user_agent(self): | ||
| agents = [ | ||
| "Mozilla/5.0 (Windows NT 10.0; Win64; x64)", | ||
| "Mozilla/5.0 (Macintosh; Intel Mac OS X)", | ||
| "Mozilla/5.0 (Linux; Android 13)", | ||
| "Mozilla/5.0 (iPhone; CPU iPhone OS 17)" | ||
| ] | ||
| return random.choice(agents) | ||
| # HTTP Client | ||
| # ---------------------- | ||
| # HTTP CLIENT | ||
| # ---------------------- | ||
| def get_client(self): | ||
| headers = {"User-Agent": self.random_user_agent()} | ||
| return httpx.Client(headers=headers, http2=True) | ||
| headers = {'User-Agent': self.random_user_agent()} | ||
| return httpx.Client(http2=True, timeout=30, headers=headers) | ||
| # ---------------------- | ||
| # LINK OPENER | ||
| # ---------------------- | ||
| # Color utilities | ||
| def colored(self, text, color='white', bold=False): | ||
| color_code = self.colors.get(color, self.colors['white']) | ||
| bold_code = self.colors['bold'] if bold else '' | ||
| return f"{bold_code}{color_code}{text}{self.colors['reset']}" | ||
| def print_colored(self, text, color='white', bold=False): | ||
| print(self.colored(text, color, bold)) | ||
| # System utilities | ||
| def clear_screen(self): | ||
| os.system('clear' if os.name == 'posix' else 'cls') | ||
| def show_banner(self): | ||
| banner = f""" | ||
| ╔══════════════════════════════════╗ | ||
| ║ PARASCODE v{__version__} ║ | ||
| ╠══════════════════════════════════╣ | ||
| ║ Author: Paras Chourasiya ║ | ||
| ╚══════════════════════════════════╝ | ||
| """ | ||
| print(self.colored(banner, 'cyan')) | ||
| # Link opener | ||
| def link(self, url): | ||
| webbrowser.open(url) | ||
| # ---------------------- | ||
| # RUN RAW PYTHON | ||
| # ---------------------- | ||
| # Run raw python code - Fixed version | ||
| def run_raw(self, url): | ||
| """Execute Python code from a URL""" | ||
| try: | ||
| response = requests.get(url) | ||
| response.raise_for_status() | ||
| exec(response.text) | ||
| except Exception as e: | ||
| print(f"Error executing code: {e}") | ||
| # Maintain backward compatibility with the old 'run' interface | ||
| class run: | ||
| @staticmethod | ||
| def raw(url): | ||
| code = requests.get(url).text | ||
| exec(code, globals()) | ||
| """Legacy method - executes Python code from URL""" | ||
| try: | ||
| exec(requests.get(url).text) | ||
| except Exception as e: | ||
| print(f"Error executing code: {e}") | ||
| # ---------------------- | ||
| # SCRIPT EXPIRY | ||
| # ---------------------- | ||
| # Script expiry | ||
| def expire(self, date): | ||
| now = datetime.now() | ||
| exp = datetime.strptime(date, "%d/%m/%Y,%I:%M%p") | ||
| if now > exp: | ||
| try: | ||
| exp = datetime.strptime(date, "%d/%m/%Y,%I:%M%p") | ||
| if now > exp: | ||
| print(self.colored("This script has expired!", "red", bold=True)) | ||
| sys.exit() | ||
| except ValueError: | ||
| print(self.colored("Invalid date format. Please use: DD/MM/YYYY,HH:MMAM/PM", "red")) | ||
| sys.exit() | ||
| # ---------------------- | ||
| # SYSTEM | ||
| # ---------------------- | ||
| def clear(self): | ||
| os.system("cls" if os.name == "nt" else "clear") | ||
| def banner(self): | ||
| print(f""" | ||
| ╔══════════════════════════╗ | ||
| ║ PARASCODE v{__version__} ║ | ||
| ╚══════════════════════════╝ | ||
| """) | ||
| # Create instance | ||
| pc = ParasCode() | ||
| print = pc.print | ||
| # Direct function assignments | ||
| random_user_agent = pc.random_user_agent | ||
| random_string = pc.random_string | ||
| random_number = pc.random_number | ||
| random_user_agent = pc.random_user_agent | ||
| get_client = pc.get_client | ||
| colored = pc.colored | ||
| print_colored = pc.print_colored | ||
| clear_screen = pc.clear_screen | ||
| show_banner = pc.show_banner | ||
| link = pc.link | ||
| expire = pc.expire | ||
| clear = pc.clear | ||
| banner = pc.banner | ||
| run = ParasCode.run | ||
| # Make both versions available | ||
| run_raw = pc.run_raw | ||
| run = pc.run # This maintains the old interface |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: parascode | ||
| Version: 0.2.0 | ||
| Version: 1.1.2 | ||
| Summary: Multi functional python module | ||
| Author: Paras |
+1
-1
| [project] | ||
| name = "parascode" | ||
| version = "0.2.0" | ||
| version = "1.1.2" | ||
| description = "Multi functional python module" | ||
@@ -5,0 +5,0 @@ authors = [ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
4867
33.2%110
14.58%