Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KazukiPrzyborowski authored Sep 17, 2023
1 parent 053acf1 commit ca18ebd
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pywwwget.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def download_from_url_file_with_urllib(httpurl, httpheaders=geturls_headers, htt
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -1009,7 +1009,7 @@ def download_from_url_file_with_httplib(httpurl, httpheaders=geturls_headers, ht
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Type': "Content", 'Content': returnval_content, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -1253,7 +1253,7 @@ def download_from_url_file_with_httplib2(httpurl, httpheaders=geturls_headers, h
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -1529,7 +1529,7 @@ def download_from_url_file_with_request(httpurl, httpheaders=geturls_headers, ht
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -1761,7 +1761,7 @@ def download_from_url_file_with_requests(httpurl, httpheaders, httpcookie, httpm
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
for databytes in geturls_text.iter_content(chunk_size=buffersize):
datasize = len(databytes);
Expand Down Expand Up @@ -2008,7 +2008,7 @@ def download_from_url_file_with_httpx(httpurl, httpheaders, httpcookie, httpmeth
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
for databytes in geturls_text.iter_content(chunk_size=buffersize):
datasize = len(databytes);
Expand Down Expand Up @@ -2255,7 +2255,7 @@ def download_from_url_file_with_httpx2(httpurl, httpheaders, httpcookie, httpmet
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
for databytes in geturls_text.iter_content(chunk_size=buffersize):
datasize = len(databytes);
Expand Down Expand Up @@ -2502,7 +2502,7 @@ def download_from_url_file_with_httpcore(httpurl, httpheaders, httpcookie, httpm
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
for databytes in geturls_text.iter_content(chunk_size=buffersize):
datasize = len(databytes);
Expand Down Expand Up @@ -2749,7 +2749,7 @@ def download_from_url_file_with_httpcore2(httpurl, httpheaders, httpcookie, http
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
for databytes in geturls_text.iter_content(chunk_size=buffersize):
datasize = len(databytes);
Expand Down Expand Up @@ -2998,7 +2998,7 @@ def download_from_url_file_with_request3(httpurl, httpheaders=geturls_headers, h
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -3249,7 +3249,7 @@ def download_from_url_file_with_urllib3(httpurl, httpheaders=geturls_headers, ht
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down Expand Up @@ -3504,7 +3504,7 @@ def download_from_url_file_with_mechanize(httpurl, httpheaders=geturls_headers,
log.info("Downloading URL "+httpurl);
with tempfile.NamedTemporaryFile('wb+', prefix=tmpfileprefix, suffix=newtmpfilesuffix, delete=False) as f:
tmpfilename = f.name;
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Headers']['Last-Modified']).timetuple())));
os.utime(tmpfilename, (time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple()), time.mktime(email.utils.parsedate_to_datetime(httpheaderout['Last-Modified']).timetuple())));
returnval = {'Type': "File", 'Filename': tmpfilename, 'Filesize': downloadsize, 'FilesizeAlt': {'IEC': get_readable_size(downloadsize, 2, "IEC"), 'SI': get_readable_size(downloadsize, 2, "SI")}, 'Headers': httpheaderout, 'Version': httpversionout, 'Method': httpmethodout, 'HeadersSent': httpheadersentout, 'URL': httpurlout, 'Code': httpcodeout};
while True:
databytes = geturls_text.read(buffersize);
Expand Down

0 comments on commit ca18ebd

Please sign in to comment.