mexc futures web client wip
This commit is contained in:
88
setup_mexc_browser.py
Normal file
88
setup_mexc_browser.py
Normal file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
MEXC Browser Setup & Runner
|
||||
|
||||
This script automatically installs dependencies and runs the MEXC browser automation.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import importlib
|
||||
|
||||
def check_and_install_requirements():
|
||||
"""Check and install required packages"""
|
||||
required_packages = [
|
||||
'selenium',
|
||||
'webdriver-manager',
|
||||
'requests'
|
||||
]
|
||||
|
||||
print("🔍 Checking required packages...")
|
||||
|
||||
missing_packages = []
|
||||
for package in required_packages:
|
||||
try:
|
||||
importlib.import_module(package.replace('-', '_'))
|
||||
print(f"✅ {package} - already installed")
|
||||
except ImportError:
|
||||
missing_packages.append(package)
|
||||
print(f"❌ {package} - missing")
|
||||
|
||||
if missing_packages:
|
||||
print(f"\n📦 Installing missing packages: {', '.join(missing_packages)}")
|
||||
|
||||
for package in missing_packages:
|
||||
try:
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
|
||||
print(f"✅ Successfully installed {package}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"❌ Failed to install {package}: {e}")
|
||||
return False
|
||||
|
||||
print("✅ All requirements satisfied!")
|
||||
return True
|
||||
|
||||
def run_browser_automation():
|
||||
"""Run the MEXC browser automation"""
|
||||
try:
|
||||
# Import and run the auto browser
|
||||
from core.mexc_webclient.auto_browser import main as auto_browser_main
|
||||
auto_browser_main()
|
||||
except ImportError:
|
||||
print("❌ Could not import auto browser module")
|
||||
print("Make sure core/mexc_webclient/auto_browser.py exists")
|
||||
except Exception as e:
|
||||
print(f"❌ Error running browser automation: {e}")
|
||||
|
||||
def main():
|
||||
"""Main setup and run function"""
|
||||
print("🚀 MEXC Browser Automation Setup")
|
||||
print("=" * 40)
|
||||
|
||||
# Check Python version
|
||||
if sys.version_info < (3, 7):
|
||||
print("❌ Python 3.7+ required")
|
||||
return
|
||||
|
||||
print(f"✅ Python {sys.version.split()[0]} detected")
|
||||
|
||||
# Install requirements
|
||||
if not check_and_install_requirements():
|
||||
print("❌ Failed to install requirements")
|
||||
return
|
||||
|
||||
print("\n🌐 Starting browser automation...")
|
||||
print("This will:")
|
||||
print("• Download ChromeDriver automatically")
|
||||
print("• Open MEXC futures page")
|
||||
print("• Capture all trading requests")
|
||||
print("• Extract session cookies")
|
||||
|
||||
input("\nPress Enter to continue...")
|
||||
|
||||
# Run the automation
|
||||
run_browser_automation()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user