tradedangerous 11.5.1__py3-none-any.whl → 11.5.3__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.

Potentially problematic release.


This version of tradedangerous might be problematic. Click here for more details.

@@ -25,9 +25,9 @@ help = (
25
25
  name = 'import'
26
26
  epilog = (
27
27
  "This sub-command provides a plugin infrastructure, and comes "
28
- "with a module to import data from Maddavo's Market Share "
29
- "(http://www.davek.com.au/td/).\n"
30
- "See \"import -P maddavo -O help\" for more help."
28
+ "with a module to import data from Tromador's Trading Dangerously server"
29
+ "(https://elite.tromador.com/).\n"
30
+ "See \"trade import -P eddblink -O help\" for more help."
31
31
  )
32
32
  wantsTradeDB = False
33
33
  arguments = [
@@ -69,7 +69,8 @@ def _collect_station_modified_times(tdenv: TradeEnv, db: sqlite3.Cursor) -> dict
69
69
 
70
70
  class ImportPlugin(plugins.ImportPluginBase):
71
71
  """
72
- Plugin that downloads data from eddb.
72
+ Import plugin that uses data files from
73
+ https://elite.tromador.com/ to update the Database.
73
74
  """
74
75
  pluginOptions = {
75
76
  'item': "Update Items using latest file from server. (Implies '-O system,station')",
@@ -4,16 +4,18 @@ from __future__ import annotations
4
4
  from collections import namedtuple
5
5
  from contextlib import contextmanager
6
6
  from datetime import datetime, timedelta
7
+ from email.utils import parsedate_to_datetime
7
8
  from pathlib import Path
8
9
  from rich.progress import Progress
9
10
 
10
11
  from .. import plugins, cache, transfers, csvexport, corrections
11
12
 
13
+ import os
14
+ import requests
12
15
  import sqlite3
13
16
  import sys
14
17
  import time
15
18
  import typing
16
-
17
19
  import ijson
18
20
 
19
21
  if sys.version_info.major == 3 and sys.version_info.minor >= 10:
@@ -277,14 +279,32 @@ class ImportPlugin(plugins.ImportPluginBase):
277
279
 
278
280
  theme = self.tdenv.theme
279
281
  BOLD, CLOSE, DIM, ITALIC = theme.bold, theme.CLOSE, theme.dim, theme.italic # pylint: disable=invalid-name
280
- # TODO: don't download file if local copy is not older
281
- # see eddblink_plug.download_file()
282
282
  if not self.file:
283
283
  url = self.url or SOURCE_URL
284
- self.print(f'Downloading prices from remote URL: {url}')
284
+ local_mod_time = 0
285
285
  self.file = Path(self.tdenv.tmpDir, "galaxy_stations.json")
286
- transfers.download(self.tdenv, url, self.file)
287
- self.print(f'Download complete, saved to local file: "{self.file}"')
286
+ if self.file.exists():
287
+ local_mod_time = self.file.stat().st_mtime
288
+
289
+ headers = {"User-Agent": "Trade-Dangerous", "Accept-Encoding": "identity"}
290
+ try:
291
+ response = requests.head(url, headers=headers, timeout=70)
292
+ except Exception as e: # pylint: disable=broad-exception-caught
293
+ self.tdenv.WARN("Problem with download:\n URL: {}\n Error: {}", url, str(e))
294
+ return False
295
+ last_modified = response.headers.get("last-modified")
296
+ dump_mod_time = parsedate_to_datetime(last_modified).timestamp()
297
+ if local_mod_time < dump_mod_time:
298
+ if self.file.exists():
299
+ self.file.unlink()
300
+ self.print(f'Downloading prices from remote URL: {url}')
301
+ try:
302
+ transfers.download(self.tdenv, url, self.file)
303
+ except Exception as e: # pylint: disable=broad-exception-caught
304
+ self.tdenv.WARN("Problem with download:\n URL: {}\n Error: {}", url, str(e))
305
+ return False
306
+ self.print(f'Download complete, saved to local file: "{self.file}"')
307
+ os.utime(self.file, (dump_mod_time, dump_mod_time))
288
308
 
289
309
  sys_desc = f"Importing {ITALIC}spansh{CLOSE} data"
290
310
 
tradedangerous/version.py CHANGED
@@ -12,5 +12,5 @@
12
12
  """just keeper of current version"""
13
13
 
14
14
  # TODO: remember to update tests when version changes
15
- __version__ = '11.5.1'
15
+ __version__ = '11.5.3'
16
16
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: tradedangerous
3
- Version: 11.5.1
3
+ Version: 11.5.3
4
4
  Summary: Trade-Dangerous is a set of powerful trading tools for Elite Dangerous, organized around one of the most powerful trade run optimizers available.
5
5
  Home-page: https://github.com/eyeonus/Trade-Dangerous
6
6
  Author: eyeonus
@@ -23,6 +23,17 @@ Requires-Dist: requests
23
23
  Requires-Dist: appJar
24
24
  Requires-Dist: ijson
25
25
  Requires-Dist: rich
26
+ Dynamic: author
27
+ Dynamic: author-email
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: keywords
33
+ Dynamic: license
34
+ Dynamic: project-url
35
+ Dynamic: requires-dist
36
+ Dynamic: summary
26
37
 
27
38
 
28
39
  ----------
@@ -21,7 +21,7 @@ tradedangerous/tradeenv.py,sha256=aIeK291Ene98kaEEu1LvlJ4KT4EvPfIXlT4IfZnpVc0,11
21
21
  tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
22
22
  tradedangerous/transfers.py,sha256=t_0Sjr4FI9lhIPwyPOXdR8d97bE611ujbKK4ioWShm0,6024
23
23
  tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
24
- tradedangerous/version.py,sha256=2l-1rl3V6vbIVm-7o42LmVsvK3wJUU0uWAuL58dbpHM,646
24
+ tradedangerous/version.py,sha256=zRa68iWjzmvpmz4IBsUJcKlNaDnryOab6peG9xB5FHI,646
25
25
  tradedangerous/commands/TEMPLATE.py,sha256=MOE69xsZPHPIMBQ-LXicfsOlCZdy-2gPX_nlnwYYil8,2026
26
26
  tradedangerous/commands/__init__.py,sha256=3gz2cnXNZNkV1gtZh0dOnCRxBkQHbeIyysRe3bM2WEE,9516
27
27
  tradedangerous/commands/buildcache_cmd.py,sha256=jhNSqHX_xX43SiSUMFiKtWpB9v4oeZ0sqfNq6DCrjUs,2181
@@ -29,7 +29,7 @@ tradedangerous/commands/buy_cmd.py,sha256=qgOBTzCvcYgLOcdkx7BpqF-rSs6GFjOL_f3Gzu
29
29
  tradedangerous/commands/commandenv.py,sha256=72hEqaZzUBsTiYzkJrGP6Z1EN7WyvyZrKHxlRQNp--4,9868
30
30
  tradedangerous/commands/exceptions.py,sha256=sisGoBvOpt25TYWWjp-s-k_--O_nZe5Zd9HhAW3SElA,3487
31
31
  tradedangerous/commands/export_cmd.py,sha256=VfxwrNU_TzrSw71KrmtmXKYCBkpDGr5KRLGPXOBewnI,4405
32
- tradedangerous/commands/import_cmd.py,sha256=PKMrO1DhOGkqAn_q9vZBxhogpFL5MHp2JyYb4qiBdq0,5633
32
+ tradedangerous/commands/import_cmd.py,sha256=czbfBR0H1jTGX67b38BxiFi77EB8COM8ImztP7yPdzo,5654
33
33
  tradedangerous/commands/local_cmd.py,sha256=tf7YMGX-vaVGNO2lvQF9EvQEN3Wj7DE9-NTSVrtaZx0,8392
34
34
  tradedangerous/commands/market_cmd.py,sha256=Ig16zDuksywiiF3Exps6UuM-ZhqgbXqkW6Lu2s9xQf0,5411
35
35
  tradedangerous/commands/nav_cmd.py,sha256=v245L1MxiUliITUgvWeeB4cL4UdkNO8n0CiP6ztrV54,8460
@@ -62,19 +62,18 @@ tradedangerous/misc/progress.py,sha256=QwWgbbhAuMB7LG0o-jy7WxN1uhLHtN0FwKkV314ul
62
62
  tradedangerous/plugins/__init__.py,sha256=TL-OIptlqNENKhoFqkFeBJn_vSw8L0pVaDJgjhaTj7A,7860
63
63
  tradedangerous/plugins/edapi_plug.py,sha256=5nqBYmjUceAt-KTfiBn7IEl443R1SsGLDmfVXgbcyms,42262
64
64
  tradedangerous/plugins/edcd_plug.py,sha256=JuDtuEM_mN9Sz2H09-qYizM-9N3cuNjgvQy7Y-wHwKw,14412
65
- tradedangerous/plugins/eddblink_plug.py,sha256=dyVaQhpElq7ceLD0bJhVeuiZoMu8Jdo3Y2hwcAcgx-4,21305
65
+ tradedangerous/plugins/eddblink_plug.py,sha256=J54Lm2-bd1wFZhK_6ZdLUT5_bHdNcJcCx3VRN6gU5Ew,21363
66
66
  tradedangerous/plugins/edmc_batch_plug.py,sha256=rrP_lFFxWsba8DPEo0WF2EdCiMoRC7tCT8z62MIvtIo,4173
67
67
  tradedangerous/plugins/journal_plug.py,sha256=5HMyoxQ7z42qj7NiL8rDxSyTN9gKikoQjyWzJLD-SYQ,23746
68
68
  tradedangerous/plugins/netlog_plug.py,sha256=yUl47l9xt3kGj9oSiY_FZaDGdnQj63oa9MBtSeIy1Zo,13469
69
- tradedangerous/plugins/spansh_plug.py,sha256=y7-yedZdGbKpliHQucz48SlggzPfVJOV_MjX5QkSdA4,36952
69
+ tradedangerous/plugins/spansh_plug.py,sha256=PXFarH_i0QASrIoTpkYjq27ZgeRqGSH9sac5OqYLMLU,38028
70
70
  tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTKibsgQ,649
71
71
  tradedangerous/templates/Category.csv,sha256=8xwUDcBZE25T6x6dZGlRUMTCqeDLt3a9LXU5h6hRHV8,250
72
72
  tradedangerous/templates/RareItem.csv,sha256=F1RhRnTD82PiwrVUO-ai2ErGH2PTqNnQaDw5mcgljXs,10483
73
73
  tradedangerous/templates/TradeDangerous.sql,sha256=XJ0T09OiS9UdYKJXXAG-rCe6T_ua4MU-icb2lD7iEz0,9342
74
- tradedangerous/templates/database_changes.json,sha256=-KszgXhUUhwI7FRPDxnkV3bv9paXGpTgnUZxZN7i5OA,371
75
- tradedangerous-11.5.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
76
- tradedangerous-11.5.1.dist-info/METADATA,sha256=yYK-c5TnEqaGG9gmaTSVGX5tzjxrY7PMuo24Vk1ljIQ,4435
77
- tradedangerous-11.5.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
78
- tradedangerous-11.5.1.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
79
- tradedangerous-11.5.1.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
80
- tradedangerous-11.5.1.dist-info/RECORD,,
74
+ tradedangerous-11.5.3.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
+ tradedangerous-11.5.3.dist-info/METADATA,sha256=FLfC5lbHnXnJ38BZ3uPDrtj79OJQlhBEi4cnhUVV584,4663
76
+ tradedangerous-11.5.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
77
+ tradedangerous-11.5.3.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
78
+ tradedangerous-11.5.3.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
79
+ tradedangerous-11.5.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- [
2
- "DROP TABLE Ship;",
3
- "CREATE TABLE Ship (ship_id INTEGER PRIMARY KEY, name VARCHAR(40) COLLATE nocase, cost INTEGER, UNIQUE (ship_id));",
4
- "DROP TABLE Upgrade;",
5
- "CREATE TABLE Upgrade(upgrade_id INTEGER PRIMARY KEY, name VARCHAR(40) COLLATE nocase, class NUMBER NOT NULL, rating CHAR(1) NOT NULL, ship VARCHAR(40) COLLATE nocase, UNIQUE (upgrade_id));"
6
- ]