dict_pics cleanup and changed tag file extensions to lowercase
This commit is contained in:
parent
8c41fe1daf
commit
a4f93af3ee
14
ebay_api.py
14
ebay_api.py
@ -400,7 +400,7 @@ class CurateData:
|
||||
|
||||
try:
|
||||
|
||||
if os.path.exists(dict_pics[pic]):
|
||||
if os.path.exists(dict_pics[pic]): # TODO DOES NOT FIND CURRENT PATHS BECUASE TAGS WILL NOW BE DIFFERENT. YOU WILL END UP RE DOWNLOADING IMAGES
|
||||
pass
|
||||
|
||||
else:
|
||||
@ -443,20 +443,22 @@ class CurateData:
|
||||
|
||||
dict_pics = {}
|
||||
for k in temp_pics_source_list:
|
||||
if re.search(r'[^/]+(?=/\$_|.(.jpg|.jpeg|.png))', k, re.IGNORECASE) and re.search(r'(.jpg|.jpeg|.png)', k, re.IGNORECASE) is not None:
|
||||
tag = re.search(r'[^/]+(?=/\$_|.(.jpg|.jpeg|.png))', k, re.IGNORECASE).group() + re.search(r'(.jpg|.jpeg|.png)', k, re.IGNORECASE).group()
|
||||
patt_1 = re.search(r'[^/]+(?=/\$_|.(.jpg|.jpeg|.png))', k, re.IGNORECASE)
|
||||
patt_2 = re.search(r'(.jpg|.jpeg|.png)', k, re.IGNORECASE)
|
||||
if patt_1 and patt_2 is not None:
|
||||
tag = patt_1.group() + patt_2.group().lower()
|
||||
file_name = target_dir + os.sep + tag
|
||||
dict_pics.update({k:file_name})
|
||||
|
||||
with open('dict_pics.txt', 'w') as f:
|
||||
json.dump(dict_pics, f)
|
||||
# with open('dict_pics.txt', 'w') as f:
|
||||
# json.dump(dict_pics, f)
|
||||
|
||||
return dict_pics # TODO still need to find sol to outliers (i.e., naming scheme for unusual source URLs)
|
||||
|
||||
def dl_pictures(self, *dict_pics):
|
||||
'''
|
||||
Downloads pictures from api to local storage using temp_pics_source_list
|
||||
and creates custom {source:target} dictionary as dict_pics
|
||||
and dict_pics
|
||||
'''
|
||||
|
||||
if not dict_pics:
|
||||
|
6
oauth_fetch.py
Normal file
6
oauth_fetch.py
Normal file
@ -0,0 +1,6 @@
|
||||
import json
|
||||
import config as cfg
|
||||
import ebay_api
|
||||
import requests
|
||||
|
||||
req_endpoint = "https://api.ebay.com/identity/v1/oauth2/token"
|
Loading…
Reference in New Issue
Block a user