Refactor proxy.
Fix creating requests for python3.