eses 1.0.0__py3-none-any.whl → 1.0.2__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
@@ -3,185 +3,202 @@ import time
3
3
  from itertools import cycle
4
4
  import threading
5
5
 
6
- # Default configuration
7
- api_url = "http://52.24.104.170:8086/RestSimulator"
8
- default_params = {
9
- "Operation": "postDonation",
10
- "available_patriotism": "0",
11
- "company_id": "4456964",
12
- "donation_sum": "100000000000",
13
- "donation_type": "0",
14
- "sender_company_id": "4456964",
15
- "user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
16
- "version_code": "22"
17
- }
6
+ class ESES:
7
+ def __init__(self):
8
+ # Default configuration
9
+ self.api_url = "http://52.24.104.170:8086/RestSimulator"
10
+ self.default_params = {
11
+ "Operation": "postDonation",
12
+ "available_patriotism": "0",
13
+ "company_id": "4456964",
14
+ "donation_sum": "100000000000",
15
+ "donation_type": "0",
16
+ "sender_company_id": "4456964",
17
+ "user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
18
+ "version_code": "22"
19
+ }
18
20
 
19
- default_headers = {
20
- "Host": "52.24.104.170:8086",
21
- "Connection": "Keep-Alive",
22
- "User-Agent": "android-async-http",
23
- "Accept-Encoding": "gzip",
24
- "Content-Length": "0"
25
- }
21
+ self.default_headers = {
22
+ "Host": "52.24.104.170:8086",
23
+ "Connection": "Keep-Alive",
24
+ "User-Agent": "android-async-http",
25
+ "Accept-Encoding": "gzip",
26
+ "Content-Length": "0"
27
+ }
26
28
 
27
- # Proxy management
28
- proxies = []
29
- proxy_cycle = None
30
- running = False
31
- rotation_thread = None
29
+ # Proxy management
30
+ self.proxies = []
31
+ self.proxy_cycle = None
32
+ self.running = False
33
+ self.rotation_thread = None
34
+ self.current_donation_params = {}
32
35
 
33
- def donate(company_name="EPSAT", country="Bulgaria", war_id="55032"):
34
- """
35
- Send a donation request with customizable parameters
36
-
37
- Args:
38
- company_name (str): Name of the company (default: "EPSAT")
39
- country (str): Country name (default: "Bulgaria")
40
- war_id (str): War ID (default: "55032")
36
+ def donate(self, company_name, country, war_id):
37
+ """
38
+ Send a donation request with required parameters
41
39
 
42
- Returns:
43
- dict: Dictionary containing status, status_code, and response/error
44
- """
45
- params = default_params.copy()
46
- params.update({
47
- "company_name": company_name,
48
- "country": country,
49
- "war_id": war_id
50
- })
51
-
52
- try:
53
- response = requests.get(
54
- api_url,
55
- params=params,
56
- headers=default_headers,
57
- timeout=10
58
- )
59
- return {
60
- "status": "success",
61
- "status_code": response.status_code,
62
- "response": response.text
63
- }
64
- except Exception as e:
65
- return {
66
- "status": "error",
67
- "error": str(e)
40
+ Args:
41
+ company_name (str): Name of the company (required)
42
+ country (str): Country name (required)
43
+ war_id (str): War ID (required)
44
+
45
+ Returns:
46
+ dict: Dictionary containing status, status_code, and response/error
47
+ """
48
+ if not all([company_name, country, war_id]):
49
+ raise ValueError("company_name, country, and war_id are all required parameters")
50
+
51
+ # Store the current donation parameters
52
+ self.current_donation_params = {
53
+ "company_name": company_name,
54
+ "country": country,
55
+ "war_id": war_id
68
56
  }
69
57
 
70
- def add_proxy(proxy):
71
- """
72
- Add a proxy to the proxy list
73
-
74
- Args:
75
- proxy (str): Proxy address in format 'http://host:port' or
76
- 'http://username:password@host:port'
77
- """
78
- if proxy not in proxies:
79
- proxies.append(proxy)
80
- global proxy_cycle
81
- proxy_cycle = cycle(proxies)
82
- return f"Proxy added: {proxy}"
83
- return f"Proxy already exists: {proxy}"
58
+ params = self.default_params.copy()
59
+ params.update(self.current_donation_params)
60
+
61
+ try:
62
+ response = requests.get(
63
+ self.api_url,
64
+ params=params,
65
+ headers=self.default_headers,
66
+ timeout=10
67
+ )
68
+ return {
69
+ "status": "success",
70
+ "status_code": response.status_code,
71
+ "response": response.text
72
+ }
73
+ except Exception as e:
74
+ return {
75
+ "status": "error",
76
+ "error": str(e)
77
+ }
78
+
79
+ def add_proxy(self, proxy):
80
+ """
81
+ Add a proxy to the proxy list (format: ip:port)
82
+
83
+ Args:
84
+ proxy (str): Proxy address in format 'ip:port'
85
+ """
86
+ # Validate proxy format
87
+ if ":" not in proxy:
88
+ raise ValueError("Proxy must be in format ip:port")
89
+
90
+ # Convert to http://ip:port format
91
+ formatted_proxy = f"http://{proxy}"
92
+
93
+ if formatted_proxy not in self.proxies:
94
+ self.proxies.append(formatted_proxy)
95
+ self.proxy_cycle = cycle(self.proxies)
96
+ return f"Proxy added: {proxy}"
97
+ return f"Proxy already exists: {proxy}"
84
98
 
85
- def clear_proxies():
86
- """Clear all proxies from the proxy list"""
87
- global proxies, proxy_cycle
88
- proxies = []
89
- proxy_cycle = None
90
- return "All proxies cleared"
99
+ def clear_proxies(self):
100
+ """Clear all proxies from the proxy list"""
101
+ self.proxies = []
102
+ self.proxy_cycle = None
103
+ return "All proxies cleared"
91
104
 
92
- def proxyrotate(requests_per_proxy=3, delay_between_rotations=20):
93
- """
94
- Rotate through proxies making requests
95
-
96
- Args:
97
- requests_per_proxy (int): Number of requests to make per proxy (default: 3)
98
- delay_between_rotations (int): Seconds to wait between full rotations (default: 20)
105
+ def rotateproxy(self, requests_per_proxy=None, delay_after_rotation=None):
106
+ """
107
+ Rotate through proxies making requests using current donation parameters
99
108
 
100
- Returns:
101
- threading.Thread: The rotation thread object
102
- """
103
- global running, proxy_cycle, rotation_thread
104
-
105
- if not proxies:
106
- raise ValueError("No proxies available. Add proxies using add_proxy()")
107
-
108
- if proxy_cycle is None:
109
- proxy_cycle = cycle(proxies)
110
-
111
- running = True
112
-
113
- def rotation_worker():
114
- while running:
115
- for proxy in proxies:
116
- if not running:
117
- break
118
-
119
- proxy_config = {
120
- 'http': proxy,
121
- 'https': proxy
122
- }
123
-
124
- for i in range(requests_per_proxy):
125
- if not running:
126
- break
127
-
128
- try:
129
- result = donate()
130
- print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy}: {result['status']} (Status: {result.get('status_code', 'N/A')})")
131
- except Exception as e:
132
- print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy} failed: {str(e)}")
133
-
134
- time.sleep(1) # Small delay between requests
109
+ Args:
110
+ requests_per_proxy (int): Number of requests to make per proxy (required)
111
+ delay_after_rotation (int): Seconds to wait after using all proxies (required)
112
+
113
+ Returns:
114
+ threading.Thread: The rotation thread object
115
+ """
116
+ # Validate required parameters
117
+ if requests_per_proxy is None:
118
+ raise ValueError("requests_per_proxy is required")
119
+ if delay_after_rotation is None:
120
+ raise ValueError("delay_after_rotation is required")
135
121
 
136
- if running:
137
- print(f"Rotation complete. Waiting {delay_between_rotations} seconds...")
138
- for _ in range(delay_between_rotations):
139
- if not running:
122
+ if not self.current_donation_params:
123
+ raise ValueError("No donation parameters set. Call donate() first")
124
+
125
+ if not self.proxies:
126
+ raise ValueError("No proxies available. Add proxies using add_proxy()")
127
+
128
+ if self.proxy_cycle is None:
129
+ self.proxy_cycle = cycle(self.proxies)
130
+
131
+ self.running = True
132
+
133
+ def rotation_worker():
134
+ while self.running:
135
+ for proxy in self.proxies:
136
+ if not self.running:
140
137
  break
141
- time.sleep(1)
142
-
143
- rotation_thread = threading.Thread(target=rotation_worker)
144
- rotation_thread.daemon = True
145
- rotation_thread.start()
146
- return rotation_thread
138
+
139
+ for i in range(requests_per_proxy):
140
+ if not self.running:
141
+ break
142
+
143
+ try:
144
+ result = self.donate(
145
+ self.current_donation_params["company_name"],
146
+ self.current_donation_params["country"],
147
+ self.current_donation_params["war_id"]
148
+ )
149
+ print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy}: {result['status']} (Status: {result.get('status_code', 'N/A')})")
150
+ except Exception as e:
151
+ print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy} failed: {str(e)}")
152
+
153
+ time.sleep(1)
154
+
155
+ if self.running:
156
+ print(f"Rotation complete. Waiting {delay_after_rotation} seconds...")
157
+ for _ in range(delay_after_rotation):
158
+ if not self.running:
159
+ break
160
+ time.sleep(1)
161
+
162
+ self.rotation_thread = threading.Thread(target=rotation_worker)
163
+ self.rotation_thread.daemon = True
164
+ self.rotation_thread.start()
165
+ return self.rotation_thread
147
166
 
148
- def stop_rotation():
149
- """Stop the proxy rotation"""
150
- global running
151
- running = False
152
- if rotation_thread and rotation_thread.is_alive():
153
- rotation_thread.join(timeout=2)
154
- return "Rotation stopped"
167
+ def stop_rotation(self):
168
+ """Stop the proxy rotation"""
169
+ self.running = False
170
+ if self.rotation_thread and self.rotation_thread.is_alive():
171
+ self.rotation_thread.join(timeout=2)
172
+ return "Rotation stopped"
155
173
 
156
- def get_proxy_list():
157
- """Get the current list of proxies"""
158
- return proxies.copy()
174
+ def get_proxy_list(self):
175
+ """Get the current list of proxies (in ip:port format)"""
176
+ return [p.replace("http://", "") for p in self.proxies]
159
177
 
160
- def set_default_param(key, value):
161
- """
162
- Set a default parameter value
163
-
164
- Args:
165
- key (str): Parameter key
166
- value (str): Parameter value
167
- """
168
- if key in default_params:
169
- default_params[key] = value
170
- return f"Updated {key}"
171
- else:
172
- raise KeyError(f"Invalid parameter key: {key}")
178
+ def set_default_param(self, key, value):
179
+ """
180
+ Set a default parameter value
181
+
182
+ Args:
183
+ key (str): Parameter key
184
+ value (str): Parameter value
185
+ """
186
+ if key in self.default_params:
187
+ self.default_params[key] = value
188
+ return f"Updated {key}"
189
+ else:
190
+ raise KeyError(f"Invalid parameter key: {key}")
173
191
 
174
- def set_default_header(key, value):
175
- """
176
- Set a default header value
177
-
178
- Args:
179
- key (str): Header key
180
- value (str): Header value
181
- """
182
- default_headers[key] = value
183
- return f"Updated {key}"
192
+ def set_default_header(self, key, value):
193
+ """
194
+ Set a default header value
195
+
196
+ Args:
197
+ key (str): Header key
198
+ value (str): Header value
199
+ """
200
+ self.default_headers[key] = value
201
+ return f"Updated {key}"
184
202
 
185
- # Initialize proxy cycle if proxies exist
186
- if proxies:
187
- proxy_cycle = cycle(proxies)
203
+ # Create a module-level instance for the simple interface
204
+ eses = ESES()
eses/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.0.0"
1
+ __version__ = "1.0.2"
@@ -1,15 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eses
3
- Version: 1.0.0
4
- Summary: A library for sending donations through proxies
5
- Author-email: entente <your@email.com>
3
+ Version: 1.0.2
4
+ Summary: A library for sending donation requests with proxy rotation
5
+ Author-email: Your Name <your@email.com>
6
6
  Project-URL: Homepage, https://github.com/yourusername/eses
7
- Project-URL: Bug-Tracker, https://github.com/yourusername/eses/issues
8
7
  Classifier: Programming Language :: Python :: 3
9
8
  Classifier: License :: OSI Approved :: MIT License
10
9
  Classifier: Operating System :: OS Independent
11
- Classifier: Intended Audience :: Developers
12
- Classifier: Topic :: Software Development :: Libraries
13
10
  Requires-Python: >=3.7
14
11
  Description-Content-Type: text/markdown
12
+ License-File: LICENSE
15
13
  Requires-Dist: requests>=2.25.0
14
+ Dynamic: license-file
15
+
16
+ # eses Python Package
17
+
18
+ A library for sending donation requests with proxy rotation capabilities.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install eses
@@ -0,0 +1,7 @@
1
+ eses/__init__.py,sha256=QbmbQ1668_tQpdUUZ3vlGeLwaitoN_lD9_LYhNkSE1I,7306
2
+ eses/version.py,sha256=JqmBIiZnO_c1ce6zv6JZzf01tRk6jFq-SGGuvkL_r1U,21
3
+ eses-1.0.2.dist-info/licenses/LICENSE,sha256=aG4OK9mj5S-wNkDBtWV4cDftgrzOM901qqYwlGF2Q2U,1085
4
+ eses-1.0.2.dist-info/METADATA,sha256=WOAvu9PHyfrrc0dYXwlRxyTDIs77MaYxzCWqLY47YOU,667
5
+ eses-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ eses-1.0.2.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
7
+ eses-1.0.2.dist-info/RECORD,,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +0,0 @@
1
- eses/__init__.py,sha256=I7BxNQHWFA1D9Aaq6GyVQeIZWEK0iX8dEAJDwsqacbs,5436
2
- eses/version.py,sha256=Aj77VL1d5Mdku7sgCgKQmPuYavPpAHuZuJcy6bygQZE,21
3
- eses-1.0.0.dist-info/METADATA,sha256=2Dezt7vC14EO2GqlG7BzndzFTnQhF34jgqiMRzg2K28,629
4
- eses-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- eses-1.0.0.dist-info/top_level.txt,sha256=bhF_PMTvXEr3zbQtvND1twvnv1MQUq2hcn8kREYmePw,5
6
- eses-1.0.0.dist-info/RECORD,,
File without changes