Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
178
Issues
178
List
Boards
Labels
Milestones
Merge Requests
49
Merge Requests
49
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
88e3f70b
Commit
88e3f70b
authored
Jul 29, 2018
by
Laurent Bachelier
🐧
Committed by
Vincent A
Jul 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backends: Get proxies using stdlib functions
parent
485bf250
Pipeline
#1605
failed with stages
in 62 minutes and 14 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
24 deletions
+7
-24
setup.cfg
setup.cfg
+1
-2
weboob/applications/boobank/boobank.py
weboob/applications/boobank/boobank.py
+2
-2
weboob/core/repositories.py
weboob/core/repositories.py
+2
-2
weboob/tools/backend.py
weboob/tools/backend.py
+2
-18
No files found.
setup.cfg
View file @
88e3f70b
...
...
@@ -4,8 +4,7 @@ detailed-errors = 1
with-doctest = 1
with-coverage = 1
where = weboob
tests = weboob.tools.backend,
weboob.tools.capabilities.bank.iban,
tests = weboob.tools.capabilities.bank.iban,
weboob.tools.capabilities.bank.transactions,
weboob.tools.capabilities.paste,
weboob.tools.application.formatters.json,
...
...
weboob/applications/boobank/boobank.py
View file @
88e3f70b
...
...
@@ -41,7 +41,7 @@ from weboob.capabilities.contact import CapContact, Advisor
from
weboob.capabilities.profile
import
CapProfile
from
weboob.tools.application.repl
import
ReplApplication
,
defaultcount
from
weboob.tools.application.formatters.iformatter
import
IFormatter
,
PrettyFormatter
from
weboob.tools.
backend
import
env_
proxies
from
weboob.tools.
compat
import
get
proxies
from
weboob.tools.log
import
getLogger
from
weboob.tools.misc
import
to_unicode
...
...
@@ -788,7 +788,7 @@ class Boobank(ReplApplication):
username
,
password
=
self
.
parse_command_args
(
line
,
2
,
2
)
client
=
APIBrowser
(
baseurl
=
'https://budgea.biapi.pro/2.0/'
,
proxy
=
env_
proxies
(),
proxy
=
get
proxies
(),
logger
=
getLogger
(
'apibrowser'
,
self
.
logger
))
client
.
set_profile
(
Weboob
(
self
.
VERSION
))
client
.
TIMEOUT
=
60
...
...
weboob/core/repositories.py
View file @
88e3f70b
...
...
@@ -474,14 +474,14 @@ class Repositories(object):
def
load_browser
(
self
):
from
weboob.browser.browsers
import
Browser
from
weboob.browser.profiles
import
Weboob
as
WeboobProfile
from
weboob.tools.
backend
import
env_
proxies
from
weboob.tools.
compat
import
get
proxies
class
WeboobBrowser
(
Browser
):
PROFILE
=
WeboobProfile
(
self
.
version
)
if
self
.
browser
is
None
:
self
.
browser
=
WeboobBrowser
(
logger
=
getLogger
(
'browser'
,
parent
=
self
.
logger
),
proxy
=
env_
proxies
())
proxy
=
get
proxies
())
def
create_dir
(
self
,
name
):
if
not
os
.
path
.
exists
(
name
):
...
...
weboob/tools/backend.py
View file @
88e3f70b
...
...
@@ -23,7 +23,7 @@ from threading import RLock
from
weboob.capabilities.base
import
BaseObject
,
Capability
,
FieldNotFound
,
NotAvailable
,
NotLoaded
from
weboob.exceptions
import
ModuleInstallError
from
weboob.tools.compat
import
basestring
from
weboob.tools.compat
import
basestring
,
getproxies
from
weboob.tools.log
import
getLogger
from
weboob.tools.misc
import
iter_fields
from
weboob.tools.value
import
ValuesDict
...
...
@@ -353,7 +353,7 @@ class Module(object):
def
get_proxy
(
self
):
# Get proxies from environment variables
proxies
=
env_proxies
(
environ
=
os
.
environ
)
proxies
=
getproxies
(
)
# Override them with backend-specific config
if
'_proxy'
in
self
.
_private_config
:
proxies
[
'http'
]
=
self
.
_private_config
[
'_proxy'
]
...
...
@@ -486,19 +486,3 @@ class AbstractModule(Module):
cls
.
__bases__
=
tuple
([
parent
]
+
list
(
cls
.
iter_caps
()))
return
object
.
__new__
(
cls
)
def
env_proxies
(
environ
=
os
.
environ
):
proxies
=
{}
proxies
[
'http'
]
=
environ
.
get
(
'http_proxy'
,
environ
.
get
(
'HTTP_PROXY'
))
proxies
[
'https'
]
=
environ
.
get
(
'https_proxy'
,
environ
.
get
(
'HTTPS_PROXY'
))
return
proxies
def
test
():
assert
env_proxies
({})
==
{
'http'
:
None
,
'https'
:
None
}
assert
env_proxies
({
'http_proxy'
:
'a'
})
==
{
'http'
:
'a'
,
'https'
:
None
}
assert
env_proxies
({
'HTTP_PROXY'
:
'a'
})
==
{
'http'
:
'a'
,
'https'
:
None
}
assert
env_proxies
({
'https_proxy'
:
'b'
})
==
{
'http'
:
None
,
'https'
:
'b'
}
assert
env_proxies
({
'HTTPS_PROXY'
:
'b'
})
==
{
'http'
:
None
,
'https'
:
'b'
}
assert
env_proxies
({
'https_proxy'
:
'c'
,
'HTTPS_PROXY'
:
'd'
})
==
{
'http'
:
None
,
'https'
:
'c'
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment