cs2tracker 2.0.10__tar.gz → 2.1.0__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.
Potentially problematic release.
This version of cs2tracker might be problematic. Click here for more details.
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/PKG-INFO +1 -1
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/_version.py +2 -2
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/application.py +2 -2
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/main.py +3 -1
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/scraper.py +35 -15
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/PKG-INFO +1 -1
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/.flake8 +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/.gitignore +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/.isort.cfg +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/.pre-commit-config.yaml +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/LICENSE.md +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/MANIFEST.in +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/README.md +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/__init__.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/__main__.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/constants.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker/data/config.ini +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/SOURCES.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/dependency_links.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/entry_points.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/requires.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/cs2tracker.egg-info/top_level.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/pyproject.toml +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/requirements.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.0}/setup.cfg +0 -0
|
@@ -57,8 +57,8 @@ class Application:
|
|
|
57
57
|
|
|
58
58
|
def _edit_config(self):
|
|
59
59
|
subprocess.call([TEXT_EDITOR, CONFIG_FILE])
|
|
60
|
-
config = self.scraper.
|
|
61
|
-
self.scraper.
|
|
60
|
+
config = self.scraper.parse_config()
|
|
61
|
+
self.scraper.set_config(config)
|
|
62
62
|
|
|
63
63
|
def _draw_plot(self):
|
|
64
64
|
datesp, dollars, euros = self._parse_output()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
1
3
|
import urllib3
|
|
2
4
|
from rich.console import Console
|
|
3
5
|
|
|
@@ -23,7 +25,7 @@ def main():
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
"""
|
|
26
|
-
+ f"Version: v{version} -
|
|
28
|
+
+ f"Version: v{version} - {datetime.today().strftime('%Y/%m/%d')} - Jannik Novak @ashiven_\n"
|
|
27
29
|
)
|
|
28
30
|
|
|
29
31
|
application = Application()
|
|
@@ -23,7 +23,7 @@ from .constants import (
|
|
|
23
23
|
OUTPUT_FILE,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
MAX_LINE_LEN =
|
|
26
|
+
MAX_LINE_LEN = 72
|
|
27
27
|
PADDING_LEN = MAX_LINE_LEN // 2 - 1
|
|
28
28
|
PADDING = "-" * PADDING_LEN
|
|
29
29
|
|
|
@@ -60,8 +60,8 @@ class Scraper:
|
|
|
60
60
|
|
|
61
61
|
self.console = Console()
|
|
62
62
|
|
|
63
|
-
config = self.
|
|
64
|
-
self.
|
|
63
|
+
config = self.parse_config()
|
|
64
|
+
self.set_config(config)
|
|
65
65
|
|
|
66
66
|
def scrape_prices(self):
|
|
67
67
|
for capsule_page_url in CAPSULE_PAGES:
|
|
@@ -124,18 +124,22 @@ class Scraper:
|
|
|
124
124
|
)
|
|
125
125
|
|
|
126
126
|
def print_total(self):
|
|
127
|
-
usd_string =
|
|
127
|
+
usd_string = "USD Total".center(
|
|
128
|
+
MAX_LINE_LEN, "-"
|
|
129
|
+
) # f"{PADDING}USD Total{PADDING}"[:MAX_LINE_LEN]
|
|
128
130
|
self.console.print(f"[bold green]{usd_string}")
|
|
129
131
|
self.console.print(f"${self.total_price:.2f}")
|
|
130
132
|
|
|
131
133
|
self.total_price_euro = CurrencyConverter().convert(
|
|
132
134
|
self.total_price, "USD", "EUR"
|
|
133
135
|
)
|
|
134
|
-
eur_string =
|
|
136
|
+
eur_string = "EUR Total".center(
|
|
137
|
+
MAX_LINE_LEN, "-"
|
|
138
|
+
) # f"{PADDING}EUR Total{PADDING}"[:MAX_LINE_LEN]
|
|
135
139
|
self.console.print(f"[bold green]{eur_string}")
|
|
136
140
|
self.console.print(f"€{self.total_price_euro:.2f}")
|
|
137
141
|
end_string = f"{PADDING}{PADDING}{PADDING}"[:MAX_LINE_LEN]
|
|
138
|
-
self.console.print(f"[bold green]{end_string}")
|
|
142
|
+
self.console.print(f"[bold green]{end_string}\n")
|
|
139
143
|
|
|
140
144
|
def save_to_file(self):
|
|
141
145
|
now = datetime.datetime.now()
|
|
@@ -163,12 +167,16 @@ class Scraper:
|
|
|
163
167
|
writer.writerow([today, total])
|
|
164
168
|
writer.writerow([today, total_euro])
|
|
165
169
|
|
|
166
|
-
|
|
170
|
+
# reset total prices for next run
|
|
171
|
+
self.total_price = 0
|
|
172
|
+
self.total_price_euro = 0
|
|
173
|
+
|
|
174
|
+
def parse_config(self):
|
|
167
175
|
config = configparser.ConfigParser()
|
|
168
176
|
config.read(CONFIG_FILE)
|
|
169
177
|
return config
|
|
170
178
|
|
|
171
|
-
def
|
|
179
|
+
def set_config(self, config):
|
|
172
180
|
self.use_proxy = (
|
|
173
181
|
False if config.get("Proxy API Key", "Use_Proxy") == "False" else True
|
|
174
182
|
)
|
|
@@ -247,7 +255,9 @@ class Scraper:
|
|
|
247
255
|
capsule_quantities,
|
|
248
256
|
):
|
|
249
257
|
if any([quantity > 0 for quantity in capsule_quantities]):
|
|
250
|
-
title_string =
|
|
258
|
+
title_string = capsule_name.center(
|
|
259
|
+
MAX_LINE_LEN, "-"
|
|
260
|
+
) # f"{PADDING}{capsule_name}{PADDING}"[:MAX_LINE_LEN]
|
|
251
261
|
self.console.print(f"[bold magenta]{title_string}")
|
|
252
262
|
|
|
253
263
|
page = self._get_page(capsule_page_url)
|
|
@@ -276,23 +286,29 @@ class Scraper:
|
|
|
276
286
|
float(capsule_quantities[href_index] * price), 2
|
|
277
287
|
)
|
|
278
288
|
|
|
279
|
-
self.console.print(capsule_names_generic[href_index])
|
|
280
289
|
self.console.print(
|
|
281
|
-
f"
|
|
290
|
+
f"[bold red]{capsule_names_generic[href_index]}"
|
|
291
|
+
)
|
|
292
|
+
self.console.print(
|
|
293
|
+
f"Owned: {capsule_quantities[href_index]} Steam market price: ${price} Total: ${price_total}"
|
|
282
294
|
)
|
|
283
295
|
|
|
284
296
|
self.total_price += price_total
|
|
285
297
|
|
|
286
|
-
except
|
|
298
|
+
except Exception:
|
|
287
299
|
self.console.print("[bold red][!] Failed to find price listing")
|
|
288
300
|
break
|
|
289
301
|
|
|
302
|
+
self.console.print("\n")
|
|
303
|
+
|
|
290
304
|
def _scrape_prices_case(
|
|
291
305
|
self, case_quantities, case_page_urls, case_hrefs, case_names
|
|
292
306
|
):
|
|
293
307
|
for index, case_quantity in enumerate(case_quantities):
|
|
294
308
|
if case_quantity > 0:
|
|
295
|
-
title_string =
|
|
309
|
+
title_string = case_names[index].center(
|
|
310
|
+
MAX_LINE_LEN, "-"
|
|
311
|
+
) # f"{PADDING}{case_names[index]}{PADDING}"[:MAX_LINE_LEN]
|
|
296
312
|
self.console.print(f"[bold magenta]{title_string}")
|
|
297
313
|
|
|
298
314
|
page = self._get_page(case_page_urls[index])
|
|
@@ -317,12 +333,16 @@ class Scraper:
|
|
|
317
333
|
price = float(price_str.replace("$", ""))
|
|
318
334
|
price_total = round(float(case_quantity * price), 2)
|
|
319
335
|
|
|
320
|
-
self.console.print(
|
|
336
|
+
self.console.print(
|
|
337
|
+
f"Owned: {case_quantity} Steam market price: ${price} Total: ${price_total}"
|
|
338
|
+
)
|
|
321
339
|
|
|
322
340
|
self.total_price += price_total
|
|
323
341
|
|
|
324
|
-
except
|
|
342
|
+
except Exception:
|
|
325
343
|
self.console.print("[bold red][!] Failed to find price listing")
|
|
326
344
|
|
|
345
|
+
self.console.print("\n")
|
|
346
|
+
|
|
327
347
|
if not self.use_proxy:
|
|
328
348
|
time.sleep(1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|