eses 1.0.5__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eses
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: A library for sending donation requests with proxy rotation
5
5
  Author-email: Your Name <your@email.com>
6
6
  Project-URL: Homepage, https://github.com/yourusername/eses
@@ -0,0 +1,79 @@
1
+ import requests
2
+ import time
3
+ import threading
4
+ from concurrent.futures import ThreadPoolExecutor, as_completed
5
+ from datetime import datetime
6
+ from typing import List, Optional, Dict, Any
7
+
8
+ # API Configuration
9
+ api_url = "http://52.24.104.170:8086/RestSimulator"
10
+ proxies: List[str] = []
11
+ proxy_lock = threading.Lock()
12
+ active_threads: List[threading.Thread] = []
13
+
14
+ # Debug Utilities
15
+ def _print_debug(msg: str) -> None:
16
+ timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
17
+ print(f"[{timestamp}] {msg}")
18
+
19
+ # Core Functions (keep all existing functions exactly the same until donatewithproxy)
20
+
21
+ def donatewithproxy(
22
+ company_name: str,
23
+ country: str,
24
+ war_id: str,
25
+ times: int = 1,
26
+ delay: int = 0,
27
+ max_workers: int = 50 # High concurrency for fast bursts
28
+ ) -> None:
29
+ """
30
+ Send ALL requests in parallel bursts:
31
+ 1. Send (proxies × times) requests ALL AT ONCE
32
+ 2. Wait for ALL to complete
33
+ 3. Delay
34
+ 4. Repeat
35
+ """
36
+ def _worker():
37
+ cycle = 0
38
+ while True:
39
+ cycle += 1
40
+ _print_debug(f"=== BURST CYCLE {cycle} ===")
41
+
42
+ # Get current proxies
43
+ with proxy_lock:
44
+ current_proxies = proxies.copy() or [None]
45
+ total_requests = len(current_proxies) * times
46
+ _print_debug(f"Preparing {total_requests} concurrent requests...")
47
+
48
+ # Send ALL requests in parallel
49
+ with ThreadPoolExecutor(max_workers=max_workers) as executor:
50
+ futures = []
51
+ for proxy in current_proxies:
52
+ for _ in range(times):
53
+ futures.append(
54
+ executor.submit(
55
+ donate,
56
+ company_name,
57
+ country,
58
+ war_id,
59
+ proxy=proxy
60
+ )
61
+ )
62
+
63
+ # Just wait for ALL to complete (don't process results)
64
+ for future in as_completed(futures):
65
+ try:
66
+ future.result(timeout=30)
67
+ except:
68
+ pass # Errors already logged by donate()
69
+
70
+ # Burst complete
71
+ _print_debug(f"Burst {cycle} complete ({total_requests} requests). Waiting {delay}s...")
72
+ time.sleep(delay)
73
+
74
+ thread = threading.Thread(target=_worker, daemon=True)
75
+ thread.start()
76
+ active_threads.append(thread)
77
+ _print_debug(f"Started burst-mode controller (ID: {thread.ident})")
78
+
79
+ # Keep all other existing functions EXACTLY THE SAME
@@ -0,0 +1 @@
1
+ __version__ = "1.0.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eses
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: A library for sending donation requests with proxy rotation
5
5
  Author-email: Your Name <your@email.com>
6
6
  Project-URL: Homepage, https://github.com/yourusername/eses
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eses"
7
- version = "1.0.5" # Must match version.py
7
+ version = "1.0.7"
8
8
  authors = [
9
9
  {name = "Your Name", email = "your@email.com"},
10
10
  ]
@@ -1,136 +0,0 @@
1
- import requests
2
- import time
3
- import threading
4
- from datetime import datetime
5
- from typing import List, Optional, Dict, Any
6
-
7
- # API Configuration
8
- api_url = "http://52.24.104.170:8086/RestSimulator"
9
- proxies: List[str] = []
10
- proxy_lock = threading.Lock()
11
- active_threads: List[threading.Thread] = []
12
-
13
- # Debug Utilities
14
- def _print_debug(msg: str) -> None:
15
- """Print debug messages with timestamps"""
16
- timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
17
- print(f"[{timestamp}] {msg}")
18
-
19
- # Core Functions
20
- def addproxy(proxy: str) -> None:
21
- """Add a proxy to the rotation pool"""
22
- if not proxy.startswith(('http://', 'https://')):
23
- proxy = f"http://{proxy}"
24
-
25
- with proxy_lock:
26
- if proxy not in proxies:
27
- proxies.append(proxy)
28
- _print_debug(f"Proxy added: {proxy}")
29
- else:
30
- _print_debug(f"Proxy already exists: {proxy}")
31
-
32
- def clear_proxies() -> None:
33
- """Clear all registered proxies"""
34
- with proxy_lock:
35
- proxies.clear()
36
- _print_debug("All proxies cleared")
37
-
38
- def donate(
39
- company_name: str,
40
- country: str,
41
- war_id: str,
42
- donation_sum: str = "100000000000",
43
- proxy: Optional[str] = None
44
- ) -> Optional[Dict[str, Any]]:
45
- """
46
- Send a single donation request
47
- Returns: JSON response if successful, None otherwise
48
- """
49
- params = {
50
- "Operation": "postDonation",
51
- "available_patriotism": "0",
52
- "company_id": "4456964",
53
- "company_name": company_name,
54
- "country": country,
55
- "donation_sum": donation_sum,
56
- "donation_type": "0",
57
- "sender_company_id": "4456964",
58
- "user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
59
- "version_code": "22",
60
- "war_id": war_id
61
- }
62
-
63
- proxy_display = proxy or "DIRECT"
64
- _print_debug(f"Starting donation: {company_name} via {proxy_display}")
65
-
66
- try:
67
- start_time = time.time()
68
- response = requests.post(
69
- api_url,
70
- params=params,
71
- headers={"Content-Length": "0"},
72
- proxies={"http": proxy, "https": proxy} if proxy else None,
73
- timeout=10
74
- )
75
- elapsed_ms = int((time.time() - start_time) * 1000)
76
-
77
- _print_debug(f"Success ({response.status_code}) in {elapsed_ms}ms")
78
- _print_debug(f"Response: {response.text[:200]}")
79
- return response.json()
80
- except Exception as e:
81
- _print_debug(f"Failed via {proxy_display}: {str(e)}")
82
- return None
83
-
84
- def donatewithproxy(
85
- company_name: str,
86
- country: str,
87
- war_id: str,
88
- times: int = 1,
89
- delay: int = 0
90
- ) -> None:
91
- """
92
- Start automated donations with proxy rotation
93
- Args:
94
- times: Requests per proxy per cycle
95
- delay: Seconds between full cycles
96
- """
97
- def _worker():
98
- cycle = 0
99
- while True:
100
- cycle += 1
101
- _print_debug(f"=== START CYCLE {cycle} ===")
102
-
103
- # Get current proxy list (thread-safe)
104
- with proxy_lock:
105
- current_proxies = proxies.copy() or [None] # None means direct connection
106
-
107
- # Process each proxy
108
- for proxy in current_proxies:
109
- for attempt in range(1, times + 1):
110
- _print_debug(f"Attempt {attempt}/{times} via {proxy or 'DIRECT'}")
111
- donate(company_name, country, war_id, proxy=proxy)
112
-
113
- # Cycle complete
114
- _print_debug(f"Cycle {cycle} complete. Waiting {delay}s...")
115
- time.sleep(delay)
116
-
117
- thread = threading.Thread(target=_worker, daemon=True)
118
- thread.start()
119
- active_threads.append(thread)
120
- _print_debug(f"Started donation thread (ID: {thread.ident})")
121
-
122
- def stop_all_donations() -> None:
123
- """Gracefully stop all active donation threads"""
124
- for thread in active_threads:
125
- thread.join(timeout=1)
126
- active_threads.clear()
127
- _print_debug("All donation threads stopped")
128
-
129
- # Make functions available at package level
130
- __all__ = [
131
- 'addproxy',
132
- 'clear_proxies',
133
- 'donate',
134
- 'donatewithproxy',
135
- 'stop_all_donations'
136
- ]
@@ -1 +0,0 @@
1
- __version__ = "1.0.5
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes