Skip to content

Commit 1791e94

Browse files
authored
Add files via upload
1 parent 29413fe commit 1791e94

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

pywwwget_chatgpt.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import re
6262
import sys
6363
import json
64+
import getpass
6465
import random
6566
import platform
6667
import socket
@@ -2312,7 +2313,7 @@ def __init__(self, body_iter):
23122313
self.body = body_iter
23132314

23142315
def read(self, n=-1):
2315-
try:
2316+
try: I'm
23162317
# Yields the next chunk from the HTTPCore stream
23172318
return next(self.body)
23182319
except StopIteration:
@@ -2467,8 +2468,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, us
24672468
else:
24682469
if(isinstance(headers, list)):
24692470
headers = make_http_headers_from_list_to_dict(headers)
2470-
if(httpcookie is None):
2471-
httpcookie = tempfile.mktemp(suffix=".txt")
2471+
if httpcookie is None:
2472+
name = hashlib.sha1(getpass.getuser().encode("utf-8")).hexdigest() + ".txt"
2473+
httpcookie = os.path.join(tempfile.gettempdir(), name)
24722474
cookie_name, cookie_ext = os.path.splitext(httpcookie)
24732475
cookiefile = httpcookie
24742476
if(usehttp!="pycurl" or not havepycurl):

pywwwget_deepseek.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import sys
3030
import json
3131
import random
32+
import getpass
3233
import platform
3334
import socket
3435
import shutil
@@ -2577,8 +2578,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, us
25772578
else:
25782579
if(isinstance(headers, list)):
25792580
headers = make_http_headers_from_list_to_dict(headers)
2580-
if(httpcookie is None):
2581-
httpcookie = tempfile.mktemp(suffix=".txt")
2581+
if httpcookie is None:
2582+
name = hashlib.sha1(getpass.getuser().encode("utf-8")).hexdigest() + ".txt"
2583+
httpcookie = os.path.join(tempfile.gettempdir(), name)
25822584
cookie_name, cookie_ext = os.path.splitext(httpcookie)
25832585
cookiefile = httpcookie
25842586
if(usehttp!="pycurl" or not havepycurl):

pywwwget_merged.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import re
6565
import sys
6666
import json
67+
import getpass
6768
import random
6869
import platform
6970
import socket
@@ -2502,8 +2503,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, us
25022503
else:
25032504
if(isinstance(headers, list)):
25042505
headers = make_http_headers_from_list_to_dict(headers)
2505-
if(httpcookie is None):
2506-
httpcookie = tempfile.mktemp(suffix=".txt")
2506+
if httpcookie is None:
2507+
name = hashlib.sha1(getpass.getuser().encode("utf-8")).hexdigest() + ".txt"
2508+
httpcookie = os.path.join(tempfile.gettempdir(), name)
25072509
cookie_name, cookie_ext = os.path.splitext(httpcookie)
25082510
cookiefile = httpcookie
25092511
if(usehttp!="pycurl" or not havepycurl):

pywwwget_nextver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import re
6565
import sys
6666
import json
67+
import getpass
6768
import random
6869
import platform
6970
import socket
@@ -2484,8 +2485,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, us
24842485
else:
24852486
if(isinstance(headers, list)):
24862487
headers = make_http_headers_from_list_to_dict(headers)
2487-
if(httpcookie is None):
2488-
httpcookie = tempfile.mktemp(suffix=".txt")
2488+
if httpcookie is None:
2489+
name = hashlib.sha1(getpass.getuser().encode("utf-8")).hexdigest() + ".txt"
2490+
httpcookie = os.path.join(tempfile.gettempdir(), name)
24892491
cookie_name, cookie_ext = os.path.splitext(httpcookie)
24902492
cookiefile = httpcookie
24912493
if(usehttp!="pycurl" or not havepycurl):

0 commit comments

Comments
 (0)