@@ -33,47 +33,48 @@ def __init__(self):
3333    def  fetch (self ):
3434        """Fetch SEPTA bus and rail feeds. 
3535        """ 
36+         self .verify (BUS_FILE )
3637        # Check GitHub latest release page to see if there is a newer download available. 
37-         request  =  requests .get (URL )
38-         if  request .ok :
39-             response  =  request .json ()
40-             download_url  =  response ['assets' ][0 ]['browser_download_url' ]
41-             last_updated_str  =  response ['assets' ][0 ]['updated_at' ]
42-             last_updated  =  datetime .strptime (last_updated_str , LAST_UPDATED_FMT )
43-             stat  =  self .status .get (BUS_FILE )
44-             if  stat :
45-                 got_last  =  datetime .strptime (stat ['posted_date' ], TIMECHECK_FMT )
46-                 LOG .debug ('SEPTA GTFS last fetched: %s, last updated: %s' , got_last , last_updated )
47-                 if  got_last  >=  last_updated :
48-                     LOG .info ('No new download available for SEPTA.' )
49-                     self .update_existing_status (BUS_FILE )
50-                     self .update_existing_status (RAIL_FILE )
51-                     return 
52-             else :
53-                 LOG .info ('No previous SEPTA download found. Last update posted: %s' , last_updated )
38+         #  request = requests.get(URL)
39+         #  if request.ok:
40+         #      response = request.json()
41+         #      download_url = response['assets'][0]['browser_download_url']
42+         #      last_updated_str = response['assets'][0]['updated_at']
43+         #      last_updated = datetime.strptime(last_updated_str, LAST_UPDATED_FMT)
44+         #      stat = self.status.get(BUS_FILE)
45+         #      if stat:
46+         #          got_last = datetime.strptime(stat['posted_date'], TIMECHECK_FMT)
47+         #          LOG.debug('SEPTA GTFS last fetched: %s, last updated: %s', got_last, last_updated)
48+         #          if got_last >= last_updated:
49+         #              LOG.info('No new download available for SEPTA.')
50+         #              self.update_existing_status(BUS_FILE)
51+         #              self.update_existing_status(RAIL_FILE)
52+         #              return
53+         #      else:
54+         #          LOG.info('No previous SEPTA download found. Last update posted: %s', last_updated)
5455
55-             posted_date  =  last_updated .strftime (TIMECHECK_FMT )
56-             self .set_posted_date (BUS_FILE , posted_date )
57-             self .set_posted_date (RAIL_FILE , posted_date )
56+         #      posted_date = last_updated.strftime(TIMECHECK_FMT)
57+         #      self.set_posted_date(BUS_FILE, posted_date)
58+         #      self.set_posted_date(RAIL_FILE, posted_date)
5859
5960
60-             if  self .download (DOWNLOAD_FILE_NAME , download_url , do_stream = False ):
61-                 # remove posted date status for parent zip 
62-                 del  self .status [DOWNLOAD_FILE_NAME ]
63-                 septa_file  =  os .path .join (self .ddir , DOWNLOAD_FILE_NAME )
64-                 if  self .extract (septa_file ):
65-                     self .write_status ()
66-                 # delete download file once the two GTFS zips in it are extracted 
67-                 os .remove (septa_file )
68-             else :
69-                 # clear error for parent septa.zip download, and set statuses for bus and rail feeds 
70-                 err  =  self .status .get (DOWNLOAD_FILE_NAME , 'Could not download file' )
71-                 self .status  =  {}
72-                 self .set_error (BUS_FILE , err )
73-                 self .set_error (RAIL_FILE , err )
74-                 self .write_status ()
75-         else :
76-             LOG .error ('Could not check GitHub relases page for SEPTA.' )
61+         #      if self.download(DOWNLOAD_FILE_NAME, download_url, do_stream=False):
62+         #          # remove posted date status for parent zip
63+         #          del self.status[DOWNLOAD_FILE_NAME]
64+         #          septa_file = os.path.join(self.ddir, DOWNLOAD_FILE_NAME)
65+         #          if self.extract(septa_file):
66+         #              self.write_status()
67+         #          # delete download file once the two GTFS zips in it are extracted
68+         #          os.remove(septa_file)
69+         #      else:
70+         #          # clear error for parent septa.zip download, and set statuses for bus and rail feeds
71+         #          err = self.status.get(DOWNLOAD_FILE_NAME, 'Could not download file')
72+         #          self.status = {}
73+         #          self.set_error(BUS_FILE, err)
74+         #          self.set_error(RAIL_FILE, err)
75+         #          self.write_status()
76+         #  else:
77+         #      LOG.error('Could not check GitHub relases page for SEPTA.')
7778
7879    def  extract (self , file_name ):
7980        """Extract bus and rail GTFS files from downloaded zip, then validate each.""" 
0 commit comments