eses 1.0.4__py3-none-any.whl → 1.0.6__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 +111 -61
- eses/version.py +1 -1
- {eses-1.0.4.dist-info → eses-1.0.6.dist-info}/METADATA +1 -1
- eses-1.0.6.dist-info/RECORD +7 -0
- eses-1.0.4.dist-info/RECORD +0 -7
- {eses-1.0.4.dist-info → eses-1.0.6.dist-info}/WHEEL +0 -0
- {eses-1.0.4.dist-info → eses-1.0.6.dist-info}/licenses/LICENSE +0 -0
- {eses-1.0.4.dist-info → eses-1.0.6.dist-info}/top_level.txt +0 -0
eses/__init__.py
CHANGED
@@ -1,25 +1,52 @@
|
|
1
1
|
import requests
|
2
2
|
import time
|
3
3
|
import threading
|
4
|
-
from
|
4
|
+
from concurrent.futures import ThreadPoolExecutor
|
5
|
+
from datetime import datetime
|
6
|
+
from typing import List, Optional, Dict, Any
|
5
7
|
|
8
|
+
# API Configuration
|
6
9
|
api_url = "http://52.24.104.170:8086/RestSimulator"
|
7
|
-
proxies = []
|
10
|
+
proxies: List[str] = []
|
8
11
|
proxy_lock = threading.Lock()
|
9
|
-
active_threads = []
|
12
|
+
active_threads: List[threading.Thread] = []
|
10
13
|
|
11
|
-
|
12
|
-
|
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"""
|
13
23
|
if not proxy.startswith(('http://', 'https://')):
|
14
24
|
proxy = f"http://{proxy}"
|
25
|
+
|
15
26
|
with proxy_lock:
|
16
27
|
if proxy not in proxies:
|
17
28
|
proxies.append(proxy)
|
18
|
-
|
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")
|
19
38
|
|
20
|
-
def donate(
|
21
|
-
|
22
|
-
|
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
|
+
"""
|
23
50
|
params = {
|
24
51
|
"Operation": "postDonation",
|
25
52
|
"available_patriotism": "0",
|
@@ -33,74 +60,97 @@ def donate(company_name: str, country: str, war_id: str,
|
|
33
60
|
"version_code": "22",
|
34
61
|
"war_id": war_id
|
35
62
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
"Accept-Encoding": "gzip",
|
41
|
-
"Content-Length": "0"
|
42
|
-
}
|
63
|
+
|
64
|
+
proxy_display = proxy or "DIRECT"
|
65
|
+
_print_debug(f"Starting donation: {company_name} via {proxy_display}")
|
66
|
+
|
43
67
|
try:
|
68
|
+
start_time = time.time()
|
44
69
|
response = requests.post(
|
45
70
|
api_url,
|
46
71
|
params=params,
|
47
|
-
headers=
|
72
|
+
headers={"Content-Length": "0"},
|
48
73
|
proxies={"http": proxy, "https": proxy} if proxy else None,
|
49
74
|
timeout=10
|
50
75
|
)
|
51
|
-
|
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]}")
|
52
80
|
return response.json()
|
53
81
|
except Exception as e:
|
54
|
-
|
82
|
+
_print_debug(f"Failed via {proxy_display}: {str(e)}")
|
55
83
|
return None
|
56
84
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
time.sleep(delay)
|
66
|
-
continue
|
67
|
-
|
68
|
-
# Use all proxies in sequence
|
69
|
-
for proxy in proxies:
|
70
|
-
for _ in range(times):
|
71
|
-
donate(company_name, country, war_id, proxy=proxy)
|
72
|
-
|
73
|
-
# Delay after full cycle
|
74
|
-
time.sleep(delay)
|
75
|
-
|
76
|
-
def donatewithproxy(company_name: str, country: str, war_id: str, times: int = 1, delay: int = 0):
|
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:
|
77
93
|
"""
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
Example:
|
84
|
-
donatewithproxy("Blackrock", "India", "2382", times=3, delay=20)
|
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)
|
85
99
|
"""
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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)
|
91
138
|
thread.start()
|
92
139
|
active_threads.append(thread)
|
93
|
-
|
140
|
+
_print_debug(f"Started donation controller (ID: {thread.ident})")
|
94
141
|
|
95
|
-
def
|
96
|
-
"""
|
97
|
-
with proxy_lock:
|
98
|
-
proxies.clear()
|
99
|
-
print("Proxies cleared")
|
100
|
-
|
101
|
-
def stop_all_donations():
|
102
|
-
"""Stop all active donation threads"""
|
142
|
+
def stop_all_donations() -> None:
|
143
|
+
"""Gracefully stop all active donation threads"""
|
103
144
|
for thread in active_threads:
|
104
145
|
thread.join(timeout=1)
|
105
146
|
active_threads.clear()
|
106
|
-
|
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
|
+
]
|
eses/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "1.0.
|
1
|
+
__version__ = "1.0.6"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
eses/__init__.py,sha256=PeLhnDFbWOqRovn-qaK4YvDfU-Icpd2juHXHQ7WuxUE,4975
|
2
|
+
eses/version.py,sha256=fCDDAyG3nMZcE_hvt1RHdxkiFN3DfNSyU_k-rLUDrpE,21
|
3
|
+
eses-1.0.6.dist-info/licenses/LICENSE,sha256=aG4OK9mj5S-wNkDBtWV4cDftgrzOM901qqYwlGF2Q2U,1085
|
4
|
+
eses-1.0.6.dist-info/METADATA,sha256=7COZDlfSMlu7GuFdkYghkJzAJ246dn3JYiiGUOoGYLk,667
|
5
|
+
eses-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
+
eses-1.0.6.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
|
7
|
+
eses-1.0.6.dist-info/RECORD,,
|
eses-1.0.4.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
eses/__init__.py,sha256=rZmYeCdHswp8Bv91vIaIAS9SWmkxNPjIGQ0xtdrU6S0,3486
|
2
|
-
eses/version.py,sha256=O-a1T6uLdX0DYXelAnzqY4NDGktopbWdpKZloec7oxY,21
|
3
|
-
eses-1.0.4.dist-info/licenses/LICENSE,sha256=aG4OK9mj5S-wNkDBtWV4cDftgrzOM901qqYwlGF2Q2U,1085
|
4
|
-
eses-1.0.4.dist-info/METADATA,sha256=UFYIqKkt2CweTYfmgI-YaNC-q0N_2gj_lXttJPXrS-8,667
|
5
|
-
eses-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
-
eses-1.0.4.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
|
7
|
-
eses-1.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|