prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  REST call for requests is broken by '/' in DIDs
  Motivation
  ----------
  As discussed in #1786 , the REST call of https://github.com/rucio/rucio/blob/master/lib/rucio/web/rest/webpy/v1/request.py get broken for DIDs containing `/`
  
  Modification
  ------------
  I think that rather than doing this (*) we can pass all the needed information (scope, name, rse) as params instead of including them in the url path. 
  
  (*) https://github.com/rucio/rucio/blob/master/lib/rucio/web/rest/webpy/v1/request.py#L38
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/rucio/web/rest/webpy/v1/request.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # Copyright 2012-2018 CERN for the benefit of the ATLAS collaboration.
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #    http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 #
  16 # Authors:
  17 # - Mario Lassnig <mario.lassnig@cern.ch>, 2014-2018
  18 # - Vincent Garonne <vincent.garonne@cern.ch>, 2017
  19 #
  20 # PY3K COMPATIBLE
  21 
  22 import json
  23 
  24 from logging import getLogger, StreamHandler, DEBUG
  25 
  26 from web import application, ctx, loadhook, header
  27 
  28 from rucio.api import request
  29 from rucio.common.utils import generate_http_error, APIEncoder
  30 from rucio.web.rest.common import rucio_loadhook, RucioController, exception_wrapper
  31 
  32 
  33 LOGGER = getLogger("rucio.request")
  34 SH = StreamHandler()
  35 SH.setLevel(DEBUG)
  36 LOGGER.addHandler(SH)
  37 
  38 URLS = ('/(.+)/(.+)/(.+)', 'RequestGet',)
  39 
  40 
  41 class RequestGet(RucioController):
  42     """ REST API to get requests. """
  43 
  44     @exception_wrapper
  45     def GET(self, scope, name, rse):
  46         """
  47         List request for given DID to a destination RSE.
  48 
  49         HTTP Success:
  50             200 OK
  51 
  52         HTTP Error:
  53             401 Unauthorized
  54             404 Request Not Found
  55         """
  56 
  57         header('Content-Type', 'application/json')
  58 
  59         try:
  60             return json.dumps(request.get_request_by_did(scope=scope,
  61                                                          name=name,
  62                                                          rse=rse,
  63                                                          issuer=ctx.env.get('issuer')),
  64                               cls=APIEncoder)
  65         except:
  66             raise generate_http_error(404, 'RequestNotFound', 'No request found for DID %s:%s at RSE %s' % (scope,
  67                                                                                                             name,
  68                                                                                                             rse))
  69 
  70 
  71 """----------------------
  72    Web service startup
  73 ----------------------"""
  74 
  75 APP = application(URLS, globals())
  76 APP.add_processor(loadhook(rucio_loadhook))
  77 application = APP.wsgifunc()
  78
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/rucio/web/rest/webpy/v1/request.py b/lib/rucio/web/rest/webpy/v1/request.py
  --- a/lib/rucio/web/rest/webpy/v1/request.py
  +++ b/lib/rucio/web/rest/webpy/v1/request.py
  @@ -26,6 +26,7 @@
   from web import application, ctx, loadhook, header
   
   from rucio.api import request
  +from rucio.common.schema import SCOPE_NAME_REGEXP
   from rucio.common.utils import generate_http_error, APIEncoder
   from rucio.web.rest.common import rucio_loadhook, RucioController, exception_wrapper
   
  @@ -35,7 +36,7 @@
   SH.setLevel(DEBUG)
   LOGGER.addHandler(SH)
   
  -URLS = ('/(.+)/(.+)/(.+)', 'RequestGet',)
  +URLS = ('%s/(.+)' % SCOPE_NAME_REGEXP, 'RequestGet',)
   
   
   class RequestGet(RucioController):
  
verification_info: {"golden_diff": "diff --git a/lib/rucio/web/rest/webpy/v1/request.py b/lib/rucio/web/rest/webpy/v1/request.py\n--- a/lib/rucio/web/rest/webpy/v1/request.py\n+++ b/lib/rucio/web/rest/webpy/v1/request.py\n@@ -26,6 +26,7 @@\n from web import application, ctx, loadhook, header\n \n from rucio.api import request\n+from rucio.common.schema import SCOPE_NAME_REGEXP\n from rucio.common.utils import generate_http_error, APIEncoder\n from rucio.web.rest.common import rucio_loadhook, RucioController, exception_wrapper\n \n@@ -35,7 +36,7 @@\n SH.setLevel(DEBUG)\n LOGGER.addHandler(SH)\n \n-URLS = ('/(.+)/(.+)/(.+)', 'RequestGet',)\n+URLS = ('%s/(.+)' % SCOPE_NAME_REGEXP, 'RequestGet',)\n \n \n class RequestGet(RucioController):\n", "issue": "REST call for requests is broken by '/' in DIDs\nMotivation\r\n----------\r\nAs discussed in #1786 , the REST call of https://github.com/rucio/rucio/blob/master/lib/rucio/web/rest/webpy/v1/request.py get broken for DIDs containing `/`\r\n\r\nModification\r\n------------\r\nI think that rather than doing this (*) we can pass all the needed information (scope, name, rse) as params instead of including them in the url path. \r\n\r\n(*) https://github.com/rucio/rucio/blob/master/lib/rucio/web/rest/webpy/v1/request.py#L38\n", "before_files": [{"content": "#!/usr/bin/env python\n# Copyright 2012-2018 CERN for the benefit of the ATLAS collaboration.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# Authors:\n# - Mario Lassnig <mario.lassnig@cern.ch>, 2014-2018\n# - Vincent Garonne <vincent.garonne@cern.ch>, 2017\n#\n# PY3K COMPATIBLE\n\nimport json\n\nfrom logging import getLogger, StreamHandler, DEBUG\n\nfrom web import application, ctx, loadhook, header\n\nfrom rucio.api import request\nfrom rucio.common.utils import generate_http_error, APIEncoder\nfrom rucio.web.rest.common import rucio_loadhook, RucioController, exception_wrapper\n\n\nLOGGER = getLogger(\"rucio.request\")\nSH = StreamHandler()\nSH.setLevel(DEBUG)\nLOGGER.addHandler(SH)\n\nURLS = ('/(.+)/(.+)/(.+)', 'RequestGet',)\n\n\nclass RequestGet(RucioController):\n    \"\"\" REST API to get requests. \"\"\"\n\n    @exception_wrapper\n    def GET(self, scope, name, rse):\n        \"\"\"\n        List request for given DID to a destination RSE.\n\n        HTTP Success:\n            200 OK\n\n        HTTP Error:\n            401 Unauthorized\n            404 Request Not Found\n        \"\"\"\n\n        header('Content-Type', 'application/json')\n\n        try:\n            return json.dumps(request.get_request_by_did(scope=scope,\n                                                         name=name,\n                                                         rse=rse,\n                                                         issuer=ctx.env.get('issuer')),\n                              cls=APIEncoder)\n        except:\n            raise generate_http_error(404, 'RequestNotFound', 'No request found for DID %s:%s at RSE %s' % (scope,\n                                                                                                            name,\n                                                                                                            rse))\n\n\n\"\"\"----------------------\n   Web service startup\n----------------------\"\"\"\n\nAPP = application(URLS, globals())\nAPP.add_processor(loadhook(rucio_loadhook))\napplication = APP.wsgifunc()\n", "path": "lib/rucio/web/rest/webpy/v1/request.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# Copyright 2012-2018 CERN for the benefit of the ATLAS collaboration.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# Authors:\n# - Mario Lassnig <mario.lassnig@cern.ch>, 2014-2018\n# - Vincent Garonne <vincent.garonne@cern.ch>, 2017\n#\n# PY3K COMPATIBLE\n\nimport json\n\nfrom logging import getLogger, StreamHandler, DEBUG\n\nfrom web import application, ctx, loadhook, header\n\nfrom rucio.api import request\nfrom rucio.common.schema import SCOPE_NAME_REGEXP\nfrom rucio.common.utils import generate_http_error, APIEncoder\nfrom rucio.web.rest.common import rucio_loadhook, RucioController, exception_wrapper\n\n\nLOGGER = getLogger(\"rucio.request\")\nSH = StreamHandler()\nSH.setLevel(DEBUG)\nLOGGER.addHandler(SH)\n\nURLS = ('%s/(.+)' % SCOPE_NAME_REGEXP, 'RequestGet',)\n\n\nclass RequestGet(RucioController):\n    \"\"\" REST API to get requests. \"\"\"\n\n    @exception_wrapper\n    def GET(self, scope, name, rse):\n        \"\"\"\n        List request for given DID to a destination RSE.\n\n        HTTP Success:\n            200 OK\n\n        HTTP Error:\n            401 Unauthorized\n            404 Request Not Found\n        \"\"\"\n\n        header('Content-Type', 'application/json')\n\n        try:\n            return json.dumps(request.get_request_by_did(scope=scope,\n                                                         name=name,\n                                                         rse=rse,\n                                                         issuer=ctx.env.get('issuer')),\n                              cls=APIEncoder)\n        except:\n            raise generate_http_error(404, 'RequestNotFound', 'No request found for DID %s:%s at RSE %s' % (scope,\n                                                                                                            name,\n                                                                                                            rse))\n\n\n\"\"\"----------------------\n   Web service startup\n----------------------\"\"\"\n\nAPP = application(URLS, globals())\nAPP.add_processor(loadhook(rucio_loadhook))\napplication = APP.wsgifunc()\n", "path": "lib/rucio/web/rest/webpy/v1/request.py"}]}