cs2tracker 2.0.10__tar.gz → 2.1.1__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.1}/PKG-INFO +6 -3
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/README.md +5 -2
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/_version.py +2 -2
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/application.py +4 -4
- cs2tracker-2.1.1/cs2tracker/main.py +36 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/scraper.py +29 -19
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/PKG-INFO +6 -3
- cs2tracker-2.0.10/cs2tracker/main.py +0 -34
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/.flake8 +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/.gitignore +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/.isort.cfg +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/.pre-commit-config.yaml +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/LICENSE.md +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/MANIFEST.in +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/__init__.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/__main__.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/constants.py +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker/data/config.ini +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/SOURCES.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/dependency_links.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/entry_points.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/requires.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/cs2tracker.egg-info/top_level.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/pyproject.toml +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/requirements.txt +0 -0
- {cs2tracker-2.0.10 → cs2tracker-2.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cs2tracker
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Tracking the steam market prices of CS2 items
|
|
5
5
|
Home-page: https://github.com/ashiven/cs2tracker
|
|
6
6
|
Author: Jannik Novak
|
|
@@ -27,6 +27,9 @@ Dynamic: license-file
|
|
|
27
27
|
|
|
28
28
|
**CS2Tracker** is a tool that can be used to keep track of the steam market prices of your CS2 investment.
|
|
29
29
|
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
## Getting Started
|
|
31
34
|
|
|
32
35
|
### Prerequisites
|
|
@@ -49,10 +52,10 @@ Dynamic: license-file
|
|
|
49
52
|
|
|
50
53
|
### Options
|
|
51
54
|
|
|
52
|
-
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
53
55
|
- `Run!` to gather the current market prices of your items and calculate the total amount in USD and EUR.
|
|
56
|
+
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
54
57
|
- `Show History` to see a price chart consisting of past calculations. A new data point for this chart is generated once a day upon running the program.
|
|
55
|
-
- If you want to
|
|
58
|
+
- If you want to prevent your requests from being rate limited by the steamcommunity server, register for an API key on [Crawlbase](crawlbase.com) and enter it into the `API_Key` field at the end of the config file. This will route every request through a different proxy server.
|
|
56
59
|
|
|
57
60
|
---
|
|
58
61
|
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
**CS2Tracker** is a tool that can be used to keep track of the steam market prices of your CS2 investment.
|
|
7
7
|
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
## Getting Started
|
|
9
12
|
|
|
10
13
|
### Prerequisites
|
|
@@ -27,10 +30,10 @@
|
|
|
27
30
|
|
|
28
31
|
### Options
|
|
29
32
|
|
|
30
|
-
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
31
33
|
- `Run!` to gather the current market prices of your items and calculate the total amount in USD and EUR.
|
|
34
|
+
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
32
35
|
- `Show History` to see a price chart consisting of past calculations. A new data point for this chart is generated once a day upon running the program.
|
|
33
|
-
- If you want to
|
|
36
|
+
- If you want to prevent your requests from being rate limited by the steamcommunity server, register for an API key on [Crawlbase](crawlbase.com) and enter it into the `API_Key` field at the end of the config file. This will route every request through a different proxy server.
|
|
34
37
|
|
|
35
38
|
---
|
|
36
39
|
|
|
@@ -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()
|
|
@@ -88,7 +88,7 @@ class Application:
|
|
|
88
88
|
row_num = 0
|
|
89
89
|
|
|
90
90
|
if not os.path.isfile(OUTPUT_FILE):
|
|
91
|
-
open(OUTPUT_FILE, "w").close()
|
|
91
|
+
open(OUTPUT_FILE, "w", encoding="utf-8").close()
|
|
92
92
|
|
|
93
93
|
with open(OUTPUT_FILE, "r", newline="", encoding="utf-8") as csvfile:
|
|
94
94
|
reader = csv.reader(csvfile)
|
|
@@ -110,5 +110,5 @@ class Application:
|
|
|
110
110
|
|
|
111
111
|
def _plot_file(self):
|
|
112
112
|
if not os.path.isfile(OUTPUT_FILE):
|
|
113
|
-
open(OUTPUT_FILE, "w").close()
|
|
113
|
+
open(OUTPUT_FILE, "w", encoding="utf-8").close()
|
|
114
114
|
subprocess.call([TEXT_EDITOR, OUTPUT_FILE])
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import urllib3
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
|
|
6
|
+
from ._version import version
|
|
7
|
+
from .application import Application
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main():
|
|
11
|
+
## disable warnings for proxy requests
|
|
12
|
+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
13
|
+
|
|
14
|
+
console = Console()
|
|
15
|
+
console.print(
|
|
16
|
+
"[bold yellow]"
|
|
17
|
+
+ """
|
|
18
|
+
__ _____ _____ ______ ____ ____ __ __ _ ___ ____
|
|
19
|
+
/ ] / ___/| T| T| \\ / T / ]| l/ ] / _]| \\
|
|
20
|
+
/ / ( \\_ l__/ || || D )Y o | / / | ' / / [_ | D )
|
|
21
|
+
/ / \\__ T| __jl_j l_j| / | | / / | \\ Y _]| /
|
|
22
|
+
/ \\_ / \\ || / | | | | \\ | _ |/ \\_ | Y| [_ | \\
|
|
23
|
+
\\ | \\ || | | | | . Y| | |\\ || . || T| . Y
|
|
24
|
+
\\____j \\___jl_____j l__j l__j\\_jl__j__j \\____jl__j\\_jl_____jl__j\\_j
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
+ f"Version: v{version} - {datetime.today().strftime('%Y/%m/%d')} - Jannik Novak @ashiven_\n"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
application = Application()
|
|
32
|
+
application.run()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
main()
|
|
@@ -23,9 +23,7 @@ from .constants import (
|
|
|
23
23
|
OUTPUT_FILE,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
MAX_LINE_LEN =
|
|
27
|
-
PADDING_LEN = MAX_LINE_LEN // 2 - 1
|
|
28
|
-
PADDING = "-" * PADDING_LEN
|
|
26
|
+
MAX_LINE_LEN = 72
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
class Scraper:
|
|
@@ -60,8 +58,8 @@ class Scraper:
|
|
|
60
58
|
|
|
61
59
|
self.console = Console()
|
|
62
60
|
|
|
63
|
-
config = self.
|
|
64
|
-
self.
|
|
61
|
+
config = self.parse_config()
|
|
62
|
+
self.set_config(config)
|
|
65
63
|
|
|
66
64
|
def scrape_prices(self):
|
|
67
65
|
for capsule_page_url in CAPSULE_PAGES:
|
|
@@ -124,25 +122,25 @@ class Scraper:
|
|
|
124
122
|
)
|
|
125
123
|
|
|
126
124
|
def print_total(self):
|
|
127
|
-
usd_string =
|
|
125
|
+
usd_string = "USD Total".center(MAX_LINE_LEN, "-")
|
|
128
126
|
self.console.print(f"[bold green]{usd_string}")
|
|
129
127
|
self.console.print(f"${self.total_price:.2f}")
|
|
130
128
|
|
|
131
129
|
self.total_price_euro = CurrencyConverter().convert(
|
|
132
130
|
self.total_price, "USD", "EUR"
|
|
133
131
|
)
|
|
134
|
-
eur_string =
|
|
132
|
+
eur_string = "EUR Total".center(MAX_LINE_LEN, "-")
|
|
135
133
|
self.console.print(f"[bold green]{eur_string}")
|
|
136
134
|
self.console.print(f"€{self.total_price_euro:.2f}")
|
|
137
|
-
end_string =
|
|
138
|
-
self.console.print(f"[bold green]{end_string}")
|
|
135
|
+
end_string = "-" * MAX_LINE_LEN
|
|
136
|
+
self.console.print(f"[bold green]{end_string}\n")
|
|
139
137
|
|
|
140
138
|
def save_to_file(self):
|
|
141
139
|
now = datetime.datetime.now()
|
|
142
140
|
date = now.strftime("%Y-%m-%d")
|
|
143
141
|
|
|
144
142
|
if not os.path.isfile(OUTPUT_FILE):
|
|
145
|
-
open(OUTPUT_FILE, "w").close()
|
|
143
|
+
open(OUTPUT_FILE, "w", encoding="utf-8").close()
|
|
146
144
|
|
|
147
145
|
with open(OUTPUT_FILE, "r", encoding="utf-8") as csvfile:
|
|
148
146
|
reader = csv.reader(csvfile)
|
|
@@ -163,12 +161,16 @@ class Scraper:
|
|
|
163
161
|
writer.writerow([today, total])
|
|
164
162
|
writer.writerow([today, total_euro])
|
|
165
163
|
|
|
166
|
-
|
|
164
|
+
# reset total prices for next run
|
|
165
|
+
self.total_price = 0
|
|
166
|
+
self.total_price_euro = 0
|
|
167
|
+
|
|
168
|
+
def parse_config(self):
|
|
167
169
|
config = configparser.ConfigParser()
|
|
168
170
|
config.read(CONFIG_FILE)
|
|
169
171
|
return config
|
|
170
172
|
|
|
171
|
-
def
|
|
173
|
+
def set_config(self, config):
|
|
172
174
|
self.use_proxy = (
|
|
173
175
|
False if config.get("Proxy API Key", "Use_Proxy") == "False" else True
|
|
174
176
|
)
|
|
@@ -247,7 +249,7 @@ class Scraper:
|
|
|
247
249
|
capsule_quantities,
|
|
248
250
|
):
|
|
249
251
|
if any([quantity > 0 for quantity in capsule_quantities]):
|
|
250
|
-
title_string =
|
|
252
|
+
title_string = capsule_name.center(MAX_LINE_LEN, "-")
|
|
251
253
|
self.console.print(f"[bold magenta]{title_string}")
|
|
252
254
|
|
|
253
255
|
page = self._get_page(capsule_page_url)
|
|
@@ -276,23 +278,27 @@ class Scraper:
|
|
|
276
278
|
float(capsule_quantities[href_index] * price), 2
|
|
277
279
|
)
|
|
278
280
|
|
|
279
|
-
self.console.print(capsule_names_generic[href_index])
|
|
280
281
|
self.console.print(
|
|
281
|
-
f"
|
|
282
|
+
f"[bold red]{capsule_names_generic[href_index]}"
|
|
283
|
+
)
|
|
284
|
+
self.console.print(
|
|
285
|
+
f"Owned: {capsule_quantities[href_index]} Steam market price: ${price} Total: ${price_total}"
|
|
282
286
|
)
|
|
283
287
|
|
|
284
288
|
self.total_price += price_total
|
|
285
289
|
|
|
286
|
-
except ValueError:
|
|
290
|
+
except (AttributeError, ValueError):
|
|
287
291
|
self.console.print("[bold red][!] Failed to find price listing")
|
|
288
292
|
break
|
|
289
293
|
|
|
294
|
+
self.console.print("\n")
|
|
295
|
+
|
|
290
296
|
def _scrape_prices_case(
|
|
291
297
|
self, case_quantities, case_page_urls, case_hrefs, case_names
|
|
292
298
|
):
|
|
293
299
|
for index, case_quantity in enumerate(case_quantities):
|
|
294
300
|
if case_quantity > 0:
|
|
295
|
-
title_string =
|
|
301
|
+
title_string = case_names[index].center(MAX_LINE_LEN, "-")
|
|
296
302
|
self.console.print(f"[bold magenta]{title_string}")
|
|
297
303
|
|
|
298
304
|
page = self._get_page(case_page_urls[index])
|
|
@@ -317,12 +323,16 @@ class Scraper:
|
|
|
317
323
|
price = float(price_str.replace("$", ""))
|
|
318
324
|
price_total = round(float(case_quantity * price), 2)
|
|
319
325
|
|
|
320
|
-
self.console.print(
|
|
326
|
+
self.console.print(
|
|
327
|
+
f"Owned: {case_quantity} Steam market price: ${price} Total: ${price_total}"
|
|
328
|
+
)
|
|
321
329
|
|
|
322
330
|
self.total_price += price_total
|
|
323
331
|
|
|
324
|
-
except ValueError:
|
|
332
|
+
except (AttributeError, ValueError):
|
|
325
333
|
self.console.print("[bold red][!] Failed to find price listing")
|
|
326
334
|
|
|
335
|
+
self.console.print("\n")
|
|
336
|
+
|
|
327
337
|
if not self.use_proxy:
|
|
328
338
|
time.sleep(1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cs2tracker
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Tracking the steam market prices of CS2 items
|
|
5
5
|
Home-page: https://github.com/ashiven/cs2tracker
|
|
6
6
|
Author: Jannik Novak
|
|
@@ -27,6 +27,9 @@ Dynamic: license-file
|
|
|
27
27
|
|
|
28
28
|
**CS2Tracker** is a tool that can be used to keep track of the steam market prices of your CS2 investment.
|
|
29
29
|
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
## Getting Started
|
|
31
34
|
|
|
32
35
|
### Prerequisites
|
|
@@ -49,10 +52,10 @@ Dynamic: license-file
|
|
|
49
52
|
|
|
50
53
|
### Options
|
|
51
54
|
|
|
52
|
-
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
53
55
|
- `Run!` to gather the current market prices of your items and calculate the total amount in USD and EUR.
|
|
56
|
+
- `Edit Config` to change the specific numbers of each item you own and then save the config file.
|
|
54
57
|
- `Show History` to see a price chart consisting of past calculations. A new data point for this chart is generated once a day upon running the program.
|
|
55
|
-
- If you want to
|
|
58
|
+
- If you want to prevent your requests from being rate limited by the steamcommunity server, register for an API key on [Crawlbase](crawlbase.com) and enter it into the `API_Key` field at the end of the config file. This will route every request through a different proxy server.
|
|
56
59
|
|
|
57
60
|
---
|
|
58
61
|
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import urllib3
|
|
2
|
-
from rich.console import Console
|
|
3
|
-
|
|
4
|
-
from ._version import version
|
|
5
|
-
from .application import Application
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main():
|
|
9
|
-
## disable warnings for proxy requests
|
|
10
|
-
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
11
|
-
|
|
12
|
-
console = Console()
|
|
13
|
-
console.print(
|
|
14
|
-
"[bold yellow]"
|
|
15
|
-
+ """
|
|
16
|
-
__ _____ _____ ______ ____ ____ __ __ _ ___ ____
|
|
17
|
-
/ ] / ___/| T| T| \ / T / ]| l/ ] / _]| \\
|
|
18
|
-
/ / ( \_ l__/ || || D )Y o | / / | ' / / [_ | D )
|
|
19
|
-
/ / \__ T| __jl_j l_j| / | | / / | \ Y _]| /
|
|
20
|
-
/ \_ / \ || / | | | | \ | _ |/ \_ | Y| [_ | \\
|
|
21
|
-
\ | \ || | | | | . Y| | |\ || . || T| . Y
|
|
22
|
-
\____j \___jl_____j l__j l__j\_jl__j__j \____jl__j\_jl_____jl__j\_j
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"""
|
|
26
|
-
+ f"Version: v{version} - 11/14/2023 - Jannik Novak @ashiven_\n"
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
application = Application()
|
|
30
|
-
application.run()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if __name__ == "__main__":
|
|
34
|
-
main()
|
|
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
|