Created
September 6, 2016 18:42
-
-
Save Sandyroy95/0f07ce0bae121c238b4e7fc28cf67341 to your computer and use it in GitHub Desktop.
Hi everyone, I am currently working on a project in Locust where I have to perform a simple GET/POST operation through a proxy. I have got the entire script ready.However im having some trouble getting it through a proxy. I have tried a number of traditional python methods such as 'export HTTP_PROXY" or urllib2.ProxyHandler' but it's been of no …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserBehavior(TaskSet): | |
def on_start(self): | |
self.login() | |
def login(self): | |
proxy_support = urllib2.ProxyHandler({"https":"https://xxxxxxxxxxx"}) | |
opener = urllib2.build_opener(proxy_support) | |
urllib2.install_opener(opener) | |
urllib2.urlopen("https://yyyyyyyyyyyyyyyyyyy").read() | |
self.client.post("/persistence/login", {"Username":"Ivan", "Password":"Ivan"}) | |
@task(1) | |
def profile(self): | |
self.client.get("/persistence/forum") | |
************************************************************************* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment