-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Better alternative for "--rotate" in asynchronous access to mubeng #82
Comments
This is a great idea to improve. Will add new methods for this, like Meanwhile, we have released a new version to support synchronous requests for rotation guarantors since |
It should already be on the Example workaround: n = 0
class Thread:
loop:
request.get("http://example.com/resource1", headers={"X-Proxy-Offset": n}, proxy=localhost:mubeng_port)
request.get("http://example.com/resource2", headers={"X-Proxy-Offset": n+1}, proxy=localhost:mubeng_port)
n = n + 2
thread1 = Thread()
thread2 = Thread() |
First of all, thank you for investing your time. Overall the result is mostly as I wanted it to be. import requests
url = "http://ifconfig.me/ip"
proxy_url = "http://localhost:8000"
proxy = {"http": proxy_url, "https": proxy_url}
N = 0
r1 = requests.get(url, headers={"X-Proxy-Offset": str(N)}, proxies=proxy)
print(r1.text)
r2 = requests.get(url, headers={"X-Proxy-Offset": str(N)}, proxies=proxy)
print(r2.text)
r3 = requests.get(url, headers={"X-Proxy-Offset": str(N+1)}, proxies=proxy)
print(r3.text) A few remarks: I suggest using the following solution:
Also, passing non-numeric string to the header should be treated exceptionally. My suggestion is to return an error in a similar fashion to "Proxy server error" returned on connection error. |
Is your feature request related to a problem? Please describe.
Yes. I have 2 identical threads, both run an infinite loop that call a function that sends 2 GET requests. I need those pairs of GET requests to have the same proxy from mubeng used on them. Pseudocode to visualize:
Describe the solution you'd like
My proposition for implementation:
session_id % proxies_array_length
Describe alternatives you've considered
--rotate <AFTER>
option would not work in my case, because of asynchronous nature of threadsThe text was updated successfully, but these errors were encountered: