eses 1.0.6__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.6
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.6
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.6"
7
+ version = "1.0.7"
8
8
  authors = [
9
9
  {name = "Your Name", email = "your@email.com"},
10
10
  ]
@@ -1,156 +0,0 @@
1
- import requests
2
- import time
3
- import threading
4
- from concurrent.futures import ThreadPoolExecutor
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
- """Print debug messages with timestamps"""
17
- timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
18
- print(f"[{timestamp}] {msg}")
19
-
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
84
-
85
- def donatewithproxy(
86
- company_name: str,
87
- country: str,
88
- war_id: str,
89
- times: int = 1,
90
- delay: int = 0,
91
- max_workers: int = 10
92
- ) -> None:
93
- """
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)
99
- """
100
- def _worker():
101
- cycle = 0
102
- while True:
103
- cycle += 1
104
- _print_debug(f"=== START CYCLE {cycle} ===")
105
-
106
- # Get proxies (thread-safe)
107
- with proxy_lock:
108
- current_proxies = proxies.copy() or [None]
109
-
110
- # Process all proxies concurrently
111
- with ThreadPoolExecutor(max_workers=max_workers) as executor:
112
- # Schedule all requests
113
- futures = []
114
- for proxy in current_proxies:
115
- for _ in range(times):
116
- futures.append(
117
- executor.submit(
118
- donate,
119
- company_name,
120
- country,
121
- war_id,
122
- proxy=proxy
123
- )
124
- )
125
-
126
- # Wait for completion
127
- for future in futures:
128
- try:
129
- future.result(timeout=30)
130
- except Exception as e:
131
- _print_debug(f"Request failed: {str(e)}")
132
-
133
- # Cycle complete
134
- _print_debug(f"Cycle {cycle} complete. Waiting {delay}s...")
135
- time.sleep(delay)
136
-
137
- thread = threading.Thread(target=_worker, daemon=True)
138
- thread.start()
139
- active_threads.append(thread)
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")
148
-
149
- # Make functions available at package level
150
- __all__ = [
151
- 'addproxy',
152
- 'clear_proxies',
153
- 'donate',
154
- 'donatewithproxy',
155
- 'stop_all_donations'
156
- ]
@@ -1 +0,0 @@
1
- __version__ = "1.0.6"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes