ustroetz / python-osrm

A Python wrapper around the OSRM API
MIT License
133 stars 55 forks source link

profile name adds * for any routing URL. #52

Open hannesaddec opened 3 years ago

hannesaddec commented 3 years ago

Code adds a start to the URL path This is needed in case someone needs to use the demo server URL router.project-osrm.org/*/v1/car

however in other case the star does not exists
https://github.com/ustroetz/python-osrm/blob/8abcd85e1159492c377c0f8f2357790d34b420ca/osrm/__init__.py#L26

IMHO the * needs to be removed in L23 and L26 so it reads return("/".join([self.host, self.version, self.profile]))

zifeo commented 3 years ago

@hannesaddec Can you provide more details on why this is an issue?

hannesaddec commented 3 years ago

if you run python-osrm and set it https://XXXXyourdomainxxxx/table/v1/car/4.3262100,50.8475730;4.3262100,50.8475730;4.3262100,50.8513870;4.3322340,50.8475730;4.3322340,50.8513870 - it fails as there is no '*' in the path... applies for varies endpoints e.g. we run it with a railway endpoint

zifeo commented 3 years ago

@hannesaddec what osrm.RequestConfig are you using?

hannesaddec commented 1 year ago

note that the '*' get suppressed - not good at markdown

osrm.RequestConfig.host = "SERVERNAME/route" osrm.RequestConfig SERVERNAME/route/''/v1/driving osrm.RequestConfig.profile = 'v1/car' osrm.RequestConfig SERVERNAME/route/''/v1/v1/car

IMHO anyone needing a '' in a URLpath should set it in either th host or the profile options l22ff in init.py should be modified from def str(self): return("/".join([self.host, '', self.version, self.profile]))

def __repr__(self):
    return("/".join([self.host, '*', self.version, self.profile]))

to

def __str__(self):
    return("/".join([self.host, self.version, self.profile]))

def __repr__(self):
    return("/".join([self.host,  self.version, self.profile]))