Skip to content
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

new file, params.py #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 7 additions & 5 deletions synolopy/cgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
from urllib import urlencode

from synolopy.errors import *


TIMEOUT = 10
import synolopy.params


# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,9 +143,13 @@ def request(self, method, **kwargs):
'has been defined' % node.path()
)
session = manager.session(node) or manager.credentials(node)
return requests.get(url, cookies=session, timeout=TIMEOUT)
return requests.get(url, cookies=session, \
timeout=synolopy.params.timeout, \
verify = synolopy.params.verifySSL)
else:
return requests.get(url, timeout=TIMEOUT)
return requests.get(url, \
timeout=synolopy.params.timeout, \
verify = synolopy.params.verifySSL)


# ------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion synolopy/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from synolopy.cgi import CGIFactory, SessionManager, ValidationManager
from synolopy.errors import API_ERROR, SynologyException
import synolopy.params


class _NasValidationManager(ValidationManager):
Expand Down Expand Up @@ -31,7 +32,9 @@ def credentials(self, node):
account=self.login, passwd=self.password,
session=node.path()[:-1], format='cookie')

resp = requests.get(url, timeout=10, )
resp = requests.get(url, \
timeout=synolopy.params.timeout,\
verify=synolopy.params.verifySSL )
cookie = _NasValidationManager.validate(resp)
sid = dict(id=cookie['sid'])

Expand Down
2 changes: 2 additions & 0 deletions synolopy/params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
timeout = 10
verifySSL = True