Creating set_proxy, which generates proxy urls

Making it a function reduces the amount of repetition.
Merge pull request #1782 from multikatt/proxy

Creating set_proxy, which generates proxy urls