Skip to content

Commit 768acd0

Browse files
committed
- fixed proxy support
1 parent a389fd6 commit 768acd0

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "phub"
3-
version = "4.7.5"
3+
version = "4.7.6"
44
description = "An API for Pornhub"
55
authors = [
66
{name = 'Egsagon', email = "[email protected]"},

src/phub/consts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737

3838
RSS = 'https://www.pornhub.com/video/webmasterss'
3939

40+
PROXY = None
41+
# Example Proxy dictionary:
42+
# {"http://": "http://4.20.69.42:1337"}
43+
44+
4045
MAX_CALL_RETRIES = 4 # Maximum times a HTTPError can be reproduced
4146
MAX_CALL_TIMEOUT = .4 # Time to wait before retrying basic calls
4247
CALL_TIMEOUT = 30 # Time to wait before retrying calls (in case no error happens)

src/phub/core.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def __init__(self,
3636
*,
3737
language: literals.language = 'en',
3838
delay: Union[int, float] = 0,
39-
proxies: dict = None,
4039
login: bool = True,
4140
bypass_geo_blocking: bool = False,
4241
change_title_language: bool = True,
@@ -49,13 +48,12 @@ def __init__(self,
4948
password (str): Account password.
5049
language (str): Client language (fr, en, ru, etc.)
5150
delay (int | float): Minimum delay between requests.
52-
proxies (dict): Dictionary of proxies for the requests.
5351
login (bool): Whether to directly log in after initialization.
5452
bypass_geo_blocking (bool): Whether to bypass geo-blocking.
5553
change_title_language (bool): Whether to change title language into your language based on the input URL
5654
use_webmaster_api (bool): Whether to use the webmaster API or HTML content extraction
5755
Raises:
58-
LoginFailed: If Pornhub refuses the authentification.
56+
LoginFailed: If Pornhub refuses the authentication.
5957
The reason will be passed as the error body.
6058
'''
6159

@@ -70,7 +68,6 @@ def __init__(self,
7068
self.reset()
7169

7270
self.session.headers.update({"Accept-Language": language})
73-
self.proxies = proxies
7471
self.credentials = {'email': email,
7572
'password': password}
7673

@@ -98,9 +95,9 @@ def reset(self) -> None:
9895
self.session = httpx.Client(
9996
headers = consts.HEADERS,
10097
cookies = consts.COOKIES,
101-
follow_redirects = True
102-
)
103-
98+
follow_redirects = True,
99+
proxies = consts.PROXY)
100+
104101
self._clear_granted_token()
105102

106103
if self.bypass_geo_blocking:

0 commit comments

Comments
 (0)