nber-cli 0.1.1__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nber-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: A command-line tool to download NBER papers.
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.11
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nber-cli"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "A command-line tool to download NBER papers."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -125,16 +125,20 @@ async def update_paper_state(paper_id: str, status: str):
125
125
 
126
126
  async def download_paper(paper_id: str, save_path: str):
127
127
  """下载单个NBER论文"""
128
- if await get_paper_state(paper_id) == 'ok':
129
- logger.info(f"Skipping {paper_id}, already downloaded.")
130
- return
131
-
132
- url = f"https://www.nber.org/papers/{paper_id}.pdf"
133
128
  filepath = os.path.join(save_path, f"{paper_id}.pdf")
134
129
 
135
130
  # 确保保存路径存在
136
131
  os.makedirs(save_path, exist_ok=True)
137
132
 
133
+ state = await get_paper_state(paper_id)
134
+ if state == 'ok' and os.path.exists(filepath):
135
+ logger.info(f"Skipping {paper_id}, already downloaded.")
136
+ return
137
+ if state == 'ok' and not os.path.exists(filepath):
138
+ logger.info(f"{paper_id} marked as downloaded but file missing, re-downloading.")
139
+
140
+ url = f"https://www.nber.org/papers/{paper_id}.pdf"
141
+
138
142
  ua = UserAgent()
139
143
  headers = {'User-Agent': ua.random}
140
144
  retry_options = ExponentialRetry(attempts=MAX_RETRIES)
@@ -311,7 +311,7 @@ wheels = [
311
311
 
312
312
  [[package]]
313
313
  name = "nber-cli"
314
- version = "0.1.1"
314
+ version = "0.1.2"
315
315
  source = { editable = "." }
316
316
  dependencies = [
317
317
  { name = "aiohttp" },
File without changes
File without changes
File without changes
File without changes