copy path-quoting behavior from requests