try except added for ufc country image fetching
This commit is contained in:
parent
4e7d568ee5
commit
5caf7db1f4
@ -967,10 +967,16 @@ def updateLeagueEvents(api_key, time, logf):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
#country flags
|
#country flags
|
||||||
if each['fighter1country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
try:
|
||||||
urllib.request.urlretrieve(each['fighter1country'], 'logos/ufc_countries/' + each['fighter1country'].split('/')[-1].split('&')[0])
|
if each['fighter1country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||||
if each['fighter2country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
urllib.request.urlretrieve(each['fighter1country'], 'logos/ufc_countries/' + each['fighter1country'].split('/')[-1].split('&')[0])
|
||||||
urllib.request.urlretrieve(each['fighter2country'], 'logos/ufc_countries/' + each['fighter2country'].split('/')[-1].split('&')[0])
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if each['fighter2country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||||
|
urllib.request.urlretrieve(each['fighter2country'], 'logos/ufc_countries/' + each['fighter2country'].split('/')[-1].split('&')[0])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
for file in os.listdir('logos/ufc/'):
|
for file in os.listdir('logos/ufc/'):
|
||||||
if file not in logo_files:
|
if file not in logo_files:
|
||||||
@ -1000,10 +1006,16 @@ def updateLeagueEvents(api_key, time, logf):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
#country flags
|
#country flags
|
||||||
if each['fighter1country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
try:
|
||||||
urllib.request.urlretrieve(each['fighter1country'], 'logos/ufc_countries/' + each['fighter1country'].split('/')[-1].split('&')[0])
|
if each['fighter1country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||||
if each['fighter2country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
urllib.request.urlretrieve(each['fighter1country'], 'logos/ufc_countries/' + each['fighter1country'].split('/')[-1].split('&')[0])
|
||||||
urllib.request.urlretrieve(each['fighter2country'], 'logos/ufc_countries/' + each['fighter2country'].split('/')[-1].split('&')[0])
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if each['fighter2country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||||
|
urllib.request.urlretrieve(each['fighter2country'], 'logos/ufc_countries/' + each['fighter2country'].split('/')[-1].split('&')[0])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
for file in os.listdir('logos/ufc_past/'):
|
for file in os.listdir('logos/ufc_past/'):
|
||||||
if file not in logo_files:
|
if file not in logo_files:
|
||||||
|
Loading…
Reference in New Issue
Block a user