Authentication handling in wfdb.io.dl_files, error 403
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- authentication, data
Hướng nghiên cứu
Bắt đầu tại wfdb/io/download.py với dl_files, dl_pn_file và dl_full_file, sau đó kiểm tra RangeTransfer và _parse_headers trong wfdb/io/_url.py. Tái hiện yêu cầu 403 đối với URL PhysioNet yêu cầu xác thực và theo dõi cách quyền truy cập được xử lý; công việc được xem là hoàn tất khi có một quy trình xác thực được tài liệu hóa và được hỗ trợ, cho phép dl_files tải các tệp được chọn yêu cầu thông tin xác thực.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
I am trying to download specific files (subsets) from credentialed databases on PhysioNet using wfdb helper functions.
What I am trying to do is downloading selected files (not the entire dataset), e.g. :
from wfdb.io import dl_files
dl_files('mimiciv','data\\tmp',['hosp/patients.csv.gz'])
Stack trace
Created local base download directory: data\tmp
Downloading files...
Traceback (most recent call last):
File "c:\Users\pa10198\Documents\_code\zarrow\dev.py", line 12, in <module>
dl_files('mimiciv','data\\tmp',['hosp/patients.csv.gz'])
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\download.py", line 544, in dl_files
pool.map(dl_pn_file, dl_inputs)
File "C:\Users\pa10198\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 367, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pa10198\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 774, in get
raise self._value
File "C:\Users\pa10198\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "C:\Users\pa10198\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 48, in mapstar
return list(map(*args))
^^^^^^^^^^^^^^^^
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\download.py", line 450, in dl_pn_file
dl_full_file(url, local_file)
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\download.py", line 472, in dl_full_file
content = readfile.read()
^^^^^^^^^^^^^^^
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\_url.py", line 580, in read
result = b"".join(self._read_range(start, end))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\_url.py", line 473, in _read_range
with RangeTransfer(self._current_url, req_start, req_end) as xfer:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\_url.py", line 167, in __init__
self._parse_headers(method, self._response)
File "C:\Users\pa10198\Documents\_code\zarrow\.venv\Lib\site-packages\wfdb\io\_url.py", line 213, in _parse_headers
raise cls(
wfdb.io._url.NetFilePermissionError: 403 Error: Forbidden for url: https://physionet.org/files/mimiciv/3.1/hosp/patients.csv.gz
Remarks
- I have the credentialed physionet account and access to the databases I request.
- The same URL works in a browser after login and the file downloads successfully.
Questions
- Is there any supported way to pass authentification when using dl_files or related functions, e.g. through env vars, config, etc.
- If not, are there recommended workarounds (e.g., using cookies, tokens, or another library)? Ideally not leaving python and avoiding the multiplication of libraries within projects.
Feature idea
It would be very useful if wfdb supported:
- authentication for credentialed MIMIC-IV (and similar datasets), and
- partial downloads (which already works on the open datasets and seem supported structurally, but fail due to auth)
This would allow to avoid downloading entire large datasets and keep workflows within a single library.
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 853
- Fork
- 322
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MIT-LCP/wfdb-python
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
MIT-LCP/wfdb-python#557 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
MIT-LCP/wfdb-python#554 ·
-
WFDB path ignored Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MIT-LCP/wfdb-python#545 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
MIT-LCP/wfdb-python#540 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
MIT-LCP/wfdb-python#538 · 2 bình luận ·
Tất cả issue của MIT-LCP/wfdb-python
Issue tương tự
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getgrav/grav-plugin-api#45 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mattpocock/skills#1097 ·
-
bug uki
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sisaku-security/sisakulint#647 ·