Page 1 of 1
[SOLVED] Pyscripter and proxy settings
Published: March 22, 2023 - 5:38 PM
by croquebert
Hello everyone,
Context:
Teleworking without VPN
WAPT version: 2.2 Enterprise
Server OS: Debian 11
Administration console OS: Win10pro
Package development workstation OS: Win10pro
Hello,
We have a package development machine that needs to go through an outgoing proxy.
Proxy settings are configured globally (Internet settings) as well as in the agent and local console settings:
`http_proxy = ...`
`use_http_proxy_for_server=1` `
use_http_proxy_for_repo=1`
The console accesses the server and repository correctly.
Internet browsing goes through the proxy correctly.
However, when we run the `update_package` function, which calls the `waptguihelper.login_password_dialog` function (API access) from PyScripter, and then attacks the API via `wgets`, the connection tries to establish itself directly without going through the outgoing proxy. See the output of `netstat -an`:
TCP INTERNAL_IP_DEV_STATION:55484 EXTERNAL_IP_WAPT_SERVER:443 SYN_SENT
How can I force PyScripter to use a proxy (I haven't seen any corresponding settings)?
Sincerely,
Christophe.
Re: Pyscripter and proxy settings
Published: March 23, 2023 - 09:51
by croquebert
croquebert wrote: ↑March 22, 2023 - 5:38 PM
Hello everyone,
Context:
Teleworking without VPN
WAPT version: 2.2 Enterprise
Server OS: Debian 11
Administration console OS: Win10pro
Package development workstation OS: Win10pro
Hello,
We have a package development machine that needs to go through an outgoing proxy.
Proxy settings are configured globally (Internet settings) as well as in the agent and local console settings:
http_proxy = ...
use_http_proxy_for_server=1
use_http_proxy_for_repo=1
The console accesses the server and repository correctly.
Internet browsing goes through the proxy correctly.
However, when we run the update_package function, which calls the waptguihelper.login_password_dialog function (API access) from PyScripter, and then attacks the API via wgets, the connection tries to establish itself directly without going through the outgoing proxy. See the output of netstat -an:
TCP INTERNAL_IP_DEV_STATION:55484 EXTERNAL_IP_WAPT_SERVER:443 SYN_SENT
How can I force PyScripter to use a proxy (I haven't seen any corresponding settings)?
Christophe.
Good morning,
After reading the wgets documentation, using the proxies parameter partially solved the problem.
Pyscripter does not take global proxy settings into account, despite the initialization of these proxy settings at the internet settings level, via netsh or environment variable.
This can be problematic because there may be multiple package developers on different sites using different (and changing) proxies.
Is there a way to force Pyscripter to take global proxy settings into account so that I don't have to specify the proxy settings in the called functions?
Sincerely.
Re: Pyscripter and proxy settings
Published: March 24, 2023 - 10:29
by sfonteneau
Good morning
Note that the update packages are not linked to pyscripter or any other IDE.
Python executes the code (and you can even launch the update package from the console).
That's why we generally have the following at the beginning of update packages:
Code: Select all
proxies = get_proxies()
if not proxies:
proxies = get_proxies_from_wapt_console()
And that we then use the proxies variable in the rest of the script
`get_proxies()` retrieves the machine's proxies
get_proxies_from_wapt_console() retrieves the proxies from the console.
Re: Pyscripter and proxy settings
Published: April 3, 2023 - 1:56 PM
by croquebert
sfonteneau wrote: ↑March 24, 2023 - 10:29
Good morning
Note that the update packages are not linked to pyscripter or any other IDE.
Python executes the code (and you can even launch the update package from the console).
That's why we generally have the following at the beginning of update packages:
Code: Select all
proxies = get_proxies()
if not proxies:
proxies = get_proxies_from_wapt_console()
And that we then use the proxies variable in the rest of the script
`get_proxies()` retrieves the machine's proxies
get_proxies_from_wapt_console() retrieves the proxies from the console.
Good morning,
Thank you for the feedback.
I can indeed modify the packet code to take proxy settings into account where necessary.
I wanted to avoid this, but the global proxy settings (environment variables, netsh, etc.) don't seem to be recognized by the Python interpreter. I need to investigate further...