91 @param reply network reply to be parsed |
91 @param reply network reply to be parsed |
92 @type QNetworkReply |
92 @type QNetworkReply |
93 """ |
93 """ |
94 path = "" |
94 path = "" |
95 # step 1: check the content disposition header for a file name |
95 # step 1: check the content disposition header for a file name |
96 if reply.hasRawHeader("Content-Disposition"): |
96 if reply.hasRawHeader(b"Content-Disposition"): |
97 from E5Network.E5RFC6266 import parse_headers |
97 from E5Network.E5RFC6266 import parse_headers |
98 contentDisposition = parse_headers( |
98 contentDisposition = parse_headers( |
99 bytes(reply.rawHeader("Content-Disposition"))) |
99 bytes(reply.rawHeader(b"Content-Disposition"))) |
100 path = contentDisposition.filename() |
100 path = contentDisposition.filename() |
101 # step 2: get file name from URL |
101 # step 2: get file name from URL |
102 if not path: |
102 if not path: |
103 path = reply.url().path() |
103 path = reply.url().path() |
104 # step 3: give a generic file name |
104 # step 3: give a generic file name |