Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

aciclient = aciClient.ACI(apic_hostname, apic_username, apic_password, refresh=False)
proxies = {
'http': 'socks5://127.0.0.1:1080',
'https': 'socks5://127.0.0.1:1080'
}

aciclient = aciClient.ACI(apic_hostname, apic_username, apic_password, refresh=False, proxies=proxies)
try:
aciclient.login()

Expand Down
6 changes: 5 additions & 1 deletion aciClient/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ class ACI:
# ==============================================================================
# constructor
# ==============================================================================
def __init__(self, apicIp, apicUser, apicPasword, refresh=False):
def __init__(self, apicIp, apicUser, apicPasword, refresh=False, proxies=None):
self.__logger.debug('Constructor called')
self.apicIp = apicIp
self.apicUser = apicUser
self.apicPassword = apicPasword
self.proxies = proxies

self.baseUrl = 'https://' + self.apicIp + '/api/'
self.__logger.debug(f'BaseUrl set to: {self.baseUrl}')
Expand Down Expand Up @@ -75,6 +76,9 @@ def login(self) -> bool:
self.session.mount('https://', adapter)
self.__logger.debug('Session Object Created')

if self.proxies is not None:
self.session.proxies = self.proxies

# create credentials structure
userPass = json.dumps({'aaaUser': {'attributes': {'name': self.apicUser, 'pwd': self.apicPassword}}})

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pyOpenSSL>=23.0.0, <26
requests>=2.26.0 , <3
requests[socks]>=2.26.0 , <3
requests-mock
pytest
flake8
pysocks==1.7.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
author_email='nc_dev@netcloud.ch',
license='MIT',
packages=['aciClient'],
install_requires=['requests>=2.26.0 , <3', 'pyOpenSSL>=23.0.0, <26'],
install_requires=['requests[socks]>=2.26.0 , <3', 'pyOpenSSL>=23.0.0, <26', 'PySocks>=1.7.1, <2'],
long_description=long_description,
long_description_content_type='text/markdown',
python_requires=">=3.6",
Expand Down