Skip to content

Rutracker direct proxies patch#60

Open
helloworldmn wants to merge 1 commit intoidlesign:masterfrom
helloworldmn:proxy_patch
Open

Rutracker direct proxies patch#60
helloworldmn wants to merge 1 commit intoidlesign:masterfrom
helloworldmn:proxy_patch

Conversation

@helloworldmn
Copy link
Copy Markdown

Added proxy parameters into several RuTrackerTracker (and deeper) methods.
It might be useful in the case of proxy usage exactly in a specific RuTracker requests.
Tunnel functionality is not affected (can be used both simultaneously).

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 12, 2020

Pull Request Test Coverage Report for Build 125

  • 7 of 11 (63.64%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 62.776%

Changes Missing Coverage Covered Lines Changed/Added Lines %
torrt/utils.py 3 4 75.0%
torrt/trackers/rutracker.py 2 5 40.0%
Totals Coverage Status
Change from base Build 124: -0.02%
Covered Lines: 968
Relevant Lines: 1542

💛 - Coveralls

@idlesign
Copy link
Copy Markdown
Owner

Thank you.

Before we proceed, can you elaborate on why do you want to apply proxies exclusively to rutracker, but not for others, what's the usecase?

@helloworldmn
Copy link
Copy Markdown
Author

Just because I use only RuTracker :)
I use some parts of torrt in my custom scenarios where sometimes it needs to switch proxy "on the fly" for better load distribution among proxies. I think it's not difficult to patch all of methods, but I inspected only calls I used and didn't look into other parts of code.

Comment thread torrt/utils.py
# Drop globally set tunnels settings. See toolbox.tunnel().
r_kwargs['proxies'] = {'http': None, 'https': None}
# For using proxy exactly in a specific request
if not proxies:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the flow not inverted:

if proxies:
    ...
elif not self.tunnel:
    ...

Comment thread torrt/utils.py
:param allow_redirects:
:param cookies:
:param headers: Additional headers
:param proxies: Proxies to specific request
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why do you use to preposition here and in similar cases above. Shouldn't It be for a instead?

@idlesign
Copy link
Copy Markdown
Owner

I think it's not difficult to patch all of methods, but I inspected only calls I used and didn't look into other parts of code.

Ok, let's introduce it. You'd need to ensure CLI configuration of rutracker won't fail, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants