Skip to content

Commit

Permalink
Merge pull request #141 from phenobarbital/new-version
Browse files Browse the repository at this point in the history
fix https usage for proxy oxylabs
  • Loading branch information
phenobarbital authored Oct 11, 2024
2 parents 9eec27a + dec0d06 commit 319bf69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions proxylists/proxies/oxylabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
from .server import ProxyServer

class Oxylabs(ProxyServer):
url = 'customer-{username}-cc-{country}-sesstime-{session_time}:{password}@pr.oxylabs.io:7777'
"""
Oxylabs Proxy information.
"""
https_support: bool = True
oxylabs_base: str = 'pr.oxylabs.io:7777'
url = 'customer-{username}-cc-{country}-sesstime-{ses_time}:{password}@{oxy}'

def __init__(self, **kwargs):
self.username = kwargs.get(
Expand All @@ -24,12 +29,13 @@ def __init__(self, **kwargs):
self.customer = self.url.format(
username=self.username,
password=self.password,
session_time=self.session_time,
ses_time=self.session_time,
country=self.country,
oxy=self.oxylabs_base
)
self.proxy = {
'http': f'http://{self.customer}',
'https': f'http://{self.customer}',
'https': f'https://{self.customer}',
}

async def get_list(self):
Expand Down
6 changes: 6 additions & 0 deletions proxylists/proxies/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class ProxyServer:
url = ""
parser = None
https_support: bool = False

async def get_list(self):
timeout = aiohttp.ClientTimeout(total=60)
Expand Down Expand Up @@ -37,6 +38,11 @@ async def get_proxies(self):

async def get_proxy_list(self) -> dict:
proxies = await self.get_list()
if self.https_support is True:
return {
'http': f'http://{proxies[0]}',
'https': f'https://{proxies[0]}',
}
return {
'http': f'http://{proxies[0]}',
'https': f'http://{proxies[0]}',
Expand Down
2 changes: 1 addition & 1 deletion proxylists/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__title__ = 'proxylists'
__description__ = ('Package for getting useful proxy servers, '
'can use lists like hidemy or proxydb.')
__version__ = '0.14.0'
__version__ = '0.14.1'
__author__ = 'Jesus Lara'
__author_email__ = '[email protected]'
__license__ = 'BSD'

0 comments on commit 319bf69

Please sign in to comment.