@@ -63,7 +63,7 @@ def __post_init__(self):
6363 requests .delete , headers = {"Authorization" : f"Bearer { self .token } " }
6464 )
6565 machine_data = requests .get (
66- f"{ self .murfey_url } /instruments/ { self .instrument_name } /machine "
66+ f"{ self .murfey_url } { url_path_for ( 'session_control.router' , 'machine_info_by_instrument' , instrument_name = self .instrument_name ) } "
6767 ).json ()
6868 self .rsync_url = machine_data .get ("rsync_url" , "" )
6969 self .rsync_module = machine_data .get ("rsync_module" , "data" )
@@ -209,10 +209,10 @@ def _start_rsyncer_multigrid(
209209
210210 def _rsyncer_stopped (self , source : Path , explicit_stop : bool = False ):
211211 if explicit_stop :
212- remove_url = f"{ self .murfey_url } /sessions/ { self .session_id } /rsyncer ?source={ quote (str (source ), safe = '' )} "
212+ remove_url = f"{ self .murfey_url } { url_path_for ( 'session_control.router' , 'delete_rsyncer' , session_id = self .session_id ) } ?source={ quote (str (source ), safe = '' )} "
213213 requests .delete (remove_url )
214214 else :
215- stop_url = f"{ self .murfey_url } /sessions/ { self .session_id } /rsyncer_stopped "
215+ stop_url = f"{ self .murfey_url } { url_path_for ( 'session_control.router' , 'register_stopped_rsyncer' , session_id = self .session_id ) } "
216216 capture_post (stop_url , json = {"source" : str (source )})
217217
218218 def _finalise_rsyncer (self , source : Path ):
@@ -228,7 +228,7 @@ def _finalise_rsyncer(self, source: Path):
228228
229229 def _restart_rsyncer (self , source : Path ):
230230 self .rsync_processes [source ].restart ()
231- restarted_url = f"{ self .murfey_url } /sessions/ { self .session_id } /rsyncer_started "
231+ restarted_url = f"{ self .murfey_url } { url_path_for ( 'session_control.router' , 'register_restarted_rsyncer' , session_id = self .session_id ) } "
232232 capture_post (restarted_url , json = {"source" : str (source )})
233233
234234 def _request_watcher_stop (self , source : Path ):
@@ -251,9 +251,7 @@ def _start_rsyncer(
251251 log .info (f"starting rsyncer: { source } " )
252252 if transfer :
253253 # Always make sure the destination directory exists
254- make_directory_url = (
255- f"{ self .murfey_url } /sessions/{ self .session_id } /make_rsyncer_destination"
256- )
254+ make_directory_url = f"{ self .murfey_url } { url_path_for ('file_manip.router' , 'make_rsyncer_destination' , session_id = self .session_id )} "
257255 capture_post (make_directory_url , json = {"destination" : destination })
258256 if self ._environment :
259257 self ._environment .default_destinations [source ] = destination
@@ -323,12 +321,10 @@ def rsync_result(update: RSyncerUpdate):
323321 secondary = True ,
324322 )
325323 if restarted :
326- restarted_url = (
327- f"{ self .murfey_url } /sessions/{ self .session_id } /rsyncer_started"
328- )
324+ restarted_url = f"{ self .murfey_url } { url_path_for ('session_control.router' , 'register_restarted_rsyncer' , session_id = self .session_id )} "
329325 capture_post (restarted_url , json = {"source" : str (source )})
330326 else :
331- url = f"{ str (self ._environment .url .geturl ())} /sessions/ { str ( self ._environment .murfey_session )} /rsyncer "
327+ url = f"{ str (self ._environment .url .geturl ())} { url_path_for ( 'session_control.router' , 'register_rsyncer' , session_id = self ._environment .murfey_session )} "
332328 rsyncer_data = {
333329 "source" : str (source ),
334330 "destination" : destination ,
0 commit comments