eses 1.0.7__py3-none-any.whl → 1.0.8__py3-none-any.whl

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.
eses/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import requests
2
2
  import time
3
3
  import threading
4
- from concurrent.futures import ThreadPoolExecutor, as_completed
4
+ from concurrent.futures import ThreadPoolExecutor
5
5
  from datetime import datetime
6
6
  from typing import List, Optional, Dict, Any
7
7
 
@@ -13,10 +13,74 @@ active_threads: List[threading.Thread] = []
13
13
 
14
14
  # Debug Utilities
15
15
  def _print_debug(msg: str) -> None:
16
+ """Print debug messages with timestamps"""
16
17
  timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
17
18
  print(f"[{timestamp}] {msg}")
18
19
 
19
- # Core Functions (keep all existing functions exactly the same until donatewithproxy)
20
+ # Core Functions
21
+ def addproxy(proxy: str) -> None:
22
+ """Add a proxy to the rotation pool"""
23
+ if not proxy.startswith(('http://', 'https://')):
24
+ proxy = f"http://{proxy}"
25
+
26
+ with proxy_lock:
27
+ if proxy not in proxies:
28
+ proxies.append(proxy)
29
+ _print_debug(f"Proxy added: {proxy}")
30
+ else:
31
+ _print_debug(f"Proxy already exists: {proxy}")
32
+
33
+ def clear_proxies() -> None:
34
+ """Clear all registered proxies"""
35
+ with proxy_lock:
36
+ proxies.clear()
37
+ _print_debug("All proxies cleared")
38
+
39
+ def donate(
40
+ company_name: str,
41
+ country: str,
42
+ war_id: str,
43
+ donation_sum: str = "100000000000",
44
+ proxy: Optional[str] = None
45
+ ) -> Optional[Dict[str, Any]]:
46
+ """
47
+ Send a single donation request
48
+ Returns: JSON response if successful, None otherwise
49
+ """
50
+ params = {
51
+ "Operation": "postDonation",
52
+ "available_patriotism": "0",
53
+ "company_id": "4456964",
54
+ "company_name": company_name,
55
+ "country": country,
56
+ "donation_sum": donation_sum,
57
+ "donation_type": "0",
58
+ "sender_company_id": "4456964",
59
+ "user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
60
+ "version_code": "22",
61
+ "war_id": war_id
62
+ }
63
+
64
+ proxy_display = proxy or "DIRECT"
65
+ _print_debug(f"Starting donation: {company_name} via {proxy_display}")
66
+
67
+ try:
68
+ start_time = time.time()
69
+ response = requests.post(
70
+ api_url,
71
+ params=params,
72
+ headers={"Content-Length": "0"},
73
+ proxies={"http": proxy, "https": proxy} if proxy else None,
74
+ timeout=10
75
+ )
76
+ elapsed_ms = int((time.time() - start_time) * 1000)
77
+
78
+ _print_debug(f"Success ({response.status_code}) in {elapsed_ms}ms")
79
+ _print_debug(f"Response: {response.text[:200]}")
80
+ return response.json()
81
+ except Exception as e:
82
+ _print_debug(f"Failed via {proxy_display}: {str(e)}")
83
+ return None
20
84
 
21
85
  def donatewithproxy(
22
86
  company_name: str,
@@ -24,29 +88,28 @@ def donatewithproxy(
24
88
  war_id: str,
25
89
  times: int = 1,
26
90
  delay: int = 0,
27
- max_workers: int = 50 # High concurrency for fast bursts
91
+ max_workers: int = 10
28
92
  ) -> None:
29
93
  """
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
94
+ Start automated concurrent donations with proxy rotation
95
+ Args:
96
+ times: Requests per proxy per cycle
97
+ delay: Seconds between full cycles
98
+ max_workers: Max concurrent requests (default: 10)
35
99
  """
36
100
  def _worker():
37
101
  cycle = 0
38
102
  while True:
39
103
  cycle += 1
40
- _print_debug(f"=== BURST CYCLE {cycle} ===")
104
+ _print_debug(f"=== START CYCLE {cycle} ===")
41
105
 
42
- # Get current proxies
106
+ # Get proxies (thread-safe)
43
107
  with proxy_lock:
44
108
  current_proxies = proxies.copy() or [None]
45
- total_requests = len(current_proxies) * times
46
- _print_debug(f"Preparing {total_requests} concurrent requests...")
47
109
 
48
- # Send ALL requests in parallel
110
+ # Process all proxies concurrently
49
111
  with ThreadPoolExecutor(max_workers=max_workers) as executor:
112
+ # Schedule all requests
50
113
  futures = []
51
114
  for proxy in current_proxies:
52
115
  for _ in range(times):
@@ -60,20 +123,34 @@ def donatewithproxy(
60
123
  )
61
124
  )
62
125
 
63
- # Just wait for ALL to complete (don't process results)
64
- for future in as_completed(futures):
126
+ # Wait for completion
127
+ for future in futures:
65
128
  try:
66
129
  future.result(timeout=30)
67
- except:
68
- pass # Errors already logged by donate()
130
+ except Exception as e:
131
+ _print_debug(f"Request failed: {str(e)}")
69
132
 
70
- # Burst complete
71
- _print_debug(f"Burst {cycle} complete ({total_requests} requests). Waiting {delay}s...")
133
+ # Cycle complete
134
+ _print_debug(f"Cycle {cycle} complete. Waiting {delay}s...")
72
135
  time.sleep(delay)
73
136
 
74
137
  thread = threading.Thread(target=_worker, daemon=True)
75
138
  thread.start()
76
139
  active_threads.append(thread)
77
- _print_debug(f"Started burst-mode controller (ID: {thread.ident})")
140
+ _print_debug(f"Started donation controller (ID: {thread.ident})")
141
+
142
+ def stop_all_donations() -> None:
143
+ """Gracefully stop all active donation threads"""
144
+ for thread in active_threads:
145
+ thread.join(timeout=1)
146
+ active_threads.clear()
147
+ _print_debug("All donation threads stopped")
78
148
 
79
- # Keep all other existing functions EXACTLY THE SAME
149
+ # Make functions available at package level
150
+ __all__ = [
151
+ 'addproxy',
152
+ 'clear_proxies',
153
+ 'donate',
154
+ 'donatewithproxy',
155
+ 'stop_all_donations'
156
+ ]
eses/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.0.7"
1
+ __version__ = "1.0.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eses
3
- Version: 1.0.7
3
+ Version: 1.0.8
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,7 @@
1
+ eses/__init__.py,sha256=PeLhnDFbWOqRovn-qaK4YvDfU-Icpd2juHXHQ7WuxUE,4975
2
+ eses/version.py,sha256=p_ws-9W7HeP_RfNuGscH3UIczaDFgLeGOeDgRBhdzrc,21
3
+ eses-1.0.8.dist-info/licenses/LICENSE,sha256=aG4OK9mj5S-wNkDBtWV4cDftgrzOM901qqYwlGF2Q2U,1085
4
+ eses-1.0.8.dist-info/METADATA,sha256=YIfzoRWOW8QxuZTqiGjtw4Y6z3Hs9_0Ns98O9p7KifU,667
5
+ eses-1.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ eses-1.0.8.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
7
+ eses-1.0.8.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- eses/__init__.py,sha256=rgWTvoS0kL1TDFa9JEBAHOnAKe8IoszKZRuVT64dOSM,2771
2
- eses/version.py,sha256=98rTj2jvgnCZhTIeHpbml7e2xuhIqt_9BJNSWkWEQb8,21
3
- eses-1.0.7.dist-info/licenses/LICENSE,sha256=aG4OK9mj5S-wNkDBtWV4cDftgrzOM901qqYwlGF2Q2U,1085
4
- eses-1.0.7.dist-info/METADATA,sha256=KOr56rpLFiXh58DbEUiPY8h2euv3kn8LH48zxTVdYmA,667
5
- eses-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- eses-1.0.7.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
7
- eses-1.0.7.dist-info/RECORD,,
File without changes