broadfield-dev commited on
Commit
2294092
·
verified ·
1 Parent(s): 33b589b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -10,6 +10,7 @@ import bs4
10
  import datetime
11
  import urllib.request
12
  import uuid
 
13
  main_directory = "https://services.swpc.noaa.gov/images/animations/"
14
  sdo_source = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
15
  sdo_source_format = "https://sdo.gsfc.nasa.gov/assets/img/browse/YEAR/MONTH/DAY/DATE_IDENT_SIZE_TOOL.jpg"
@@ -95,15 +96,11 @@ def make_animation(url1="",url2="",url3="",url4="",url5="",url6="",url7="",url8=
95
  for line in spl:
96
  spl2 = line.split(">")[0]
97
  print(spl2)
98
- if spl2.endswith('/"') or spl2.endswith('.json"') or spl2.endswith('.png"') or spl2.endswith('.gif"') or spl2.endswith('.jpg"'):
99
  fin=line.split(">")[0].strip('""')
100
  link_box.append(fin)
101
  #html_out=html_out+html.replace("PAGE_LINK",fin)
102
 
103
-
104
-
105
-
106
-
107
  print("############################## LINK BOX ###############################")
108
  print(link_box)
109
  #spl = feed1.text.split("href=")
@@ -137,7 +134,7 @@ def make_animation(url1="",url2="",url3="",url4="",url5="",url6="",url7="",url8=
137
  files_out.append(f'{uid}.gif')
138
  html_out=f"<style>{css}</style><div>"
139
 
140
- html_out+=f'<div class="img_class"><img src="{uid}.gif"></div>'
141
  html_out+="</div>"
142
  except Exception as e:
143
  print("ERROR HAPPENED")
 
10
  import datetime
11
  import urllib.request
12
  import uuid
13
+ import os
14
  main_directory = "https://services.swpc.noaa.gov/images/animations/"
15
  sdo_source = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
16
  sdo_source_format = "https://sdo.gsfc.nasa.gov/assets/img/browse/YEAR/MONTH/DAY/DATE_IDENT_SIZE_TOOL.jpg"
 
96
  for line in spl:
97
  spl2 = line.split(">")[0]
98
  print(spl2)
99
+ if spl2.endswith('.json"') or spl2.endswith('.png"') or spl2.endswith('.gif"') or spl2.endswith('.jpg"'):
100
  fin=line.split(">")[0].strip('""')
101
  link_box.append(fin)
102
  #html_out=html_out+html.replace("PAGE_LINK",fin)
103
 
 
 
 
 
104
  print("############################## LINK BOX ###############################")
105
  print(link_box)
106
  #spl = feed1.text.split("href=")
 
134
  files_out.append(f'{uid}.gif')
135
  html_out=f"<style>{css}</style><div>"
136
 
137
+ html_out+=f'<div class="img_class"><img src="{os.getcwd()}/{uid}.gif"></div>'
138
  html_out+="</div>"
139
  except Exception as e:
140
  print("ERROR HAPPENED")