from urllib.parse import urlencode

from sanic.request import Request


def update_param(request: Request, param: str, value: str = None) -> str:
    path = request.path
    params = dict(request.query_args)
    if value:
        params[param] = value
    else:
        params.pop(param, None)

    if params:
        path += "?" + urlencode(params)

    return path

6e521fe20451b312beee5bc01c73f466df20229a
<mask token>

<mask token>


def update_param(request: Request, param: str, value: str=None) ->str:
    path = request.path
    params = dict(request.query_args)
    if value:
        params[param] = value
    else:
        params.pop(param, None)
    if params:
        path += '?' + urlencode(params)
    return path

from urllib.parse import urlencode
from sanic.request import Request


def update_param(request: Request, param: str, value: str=None) ->str:
    path = request.path
    params = dict(request.query_args)
    if value:
        params[param] = value
    else:
        params.pop(param, None)
    if params:
        path += '?' + urlencode(params)
    return path

from urllib.parse import urlencode

from sanic.request import Request


def update_param(request: Request, param: str, value: str = None) -> str:
    path = request.path
    params = dict(request.query_args)
    if value:
        params[param] = value
    else:
        params.pop(param, None)

    if params:
        path += "?" + urlencode(params)

    return path
