Search code examples
pythonurlcherrypy

Passing file path argument to a CherryPy


In CherryPy how do you pass an argument like file path (i.e. /abc/def/ghi) through a URL? I want to do something like http://...../filepath="abc/def/ghi". Thanks.


Solution

  • What about using ~ as a delimiter and then just replace ~ in the string with /...

    http://...../filepath=abc~def~ghi
    
    def SomePage(self, filepath=None):
        filepath.replace('~', '/')
        return 'HelloWorld'
    

    Hope this helps,

    Andrew