Skip to content

Changing Accept-Encoding from "*/*" to "*" #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
achuthpv opened this issue Jul 30, 2018 · 0 comments
Closed

Changing Accept-Encoding from "*/*" to "*" #140

achuthpv opened this issue Jul 30, 2018 · 0 comments

Comments

@achuthpv
Copy link

achuthpv commented Jul 30, 2018

With the latest feature of setting URL for downloading data files, I am able to change the base URL of a database as expected. I am able to download .dat files from Physionet database as expected. But when I started using a database which we have hosted on Azure blob (files are downloadable via https), we started facing issue with the following Accept encoding setting
Accept-Encoding': '*/*' which is present in dl_pb_file() and _stream_dat() in wfdb.io.download.py.
Following was the crash message

/home/achuth/wfdb-python/wfdb/io/record.py in rdrecord(record_name, sampfrom, sampto, channels, physical, pb_dir, m2s, smooth_frames, ignore_skew, return_res, force_channels, channel_names, warn_empty)
   1230                                                   record.skew, sampfrom, sampto,
   1231                                                   channels, smooth_frames,
-> 1232                                                   ignore_skew)
   1233 
   1234             # Arrange/edit the object fields to reflect user channel

/home/achuth/wfdb-python/wfdb/io/_signal.py in _rd_segment(file_name, dir_name, pb_dir, fmt, n_sig, sig_len, byte_offset, samps_per_frame, skew, sampfrom, sampto, channels, smooth_frames, ignore_skew)
    874                 w_fmt[fn], len(datchannel[fn]), sig_len, w_byte_offset[fn],
    875                 w_samps_per_frame[fn], w_skew[fn], sampfrom, sampto,
--> 876                 smooth_frames)[:, r_w_channel[fn]]
    877 
    878     # Return each sample in signals with multiple samples/frame, without smoothing.

/home/achuth/wfdb-python/wfdb/io/_signal.py in _rd_dat_signals(file_name, dir_name, pb_dir, fmt, n_sig, sig_len, byte_offset, samps_per_frame, skew, sampfrom, sampto, smooth_frames)
    966     else:
    967         sig_data = _rd_dat_file(file_name, dir_name, pb_dir, fmt, start_byte,
--> 968                                  n_read_samples)
    969 
    970     # Finish processing the read data into proper samples if not already

/home/achuth/wfdb-python/wfdb/io/_signal.py in _rd_dat_file(file_name, dir_name, pb_dir, fmt, start_byte, n_samp)
   1230         sig_data = download._stream_dat(file_name, pb_dir, byte_count,
   1231                                         start_byte,
-> 1232                                         np.dtype(DATA_LOAD_TYPES[fmt]))
   1233 
   1234     return sig_data

/home/achuth/wfdb-python/wfdb/io/download.py in _stream_dat(file_name, pb_dir, byte_count, start_byte, dtype)
    152 
    153     # Raise HTTPError if invalid url
--> 154     response.raise_for_status()
    155 
    156     # Convert to numpy array

/usr/local/lib/python3.4/dist-packages/requests/models.py in raise_for_status(self)
    937 
    938         if http_error_msg:
--> 939             raise HTTPError(http_error_msg, response=self)
    940 
    941     def close(self):

For testing, I changed it to Accept-Encoding': '*' at both the places. Then I was able to download .dat files from both Physionet database as well as our Azure blob database.

Is there any reason because of which you are using Accept-Encoding': '*/*' instead of Accept-Encoding': '*' ?

@cx1111 cx1111 closed this as completed in 70b12f6 Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant