pyapp icon indicating copy to clipboard operation
pyapp copied to clipboard

Usage behind Corporate Proxy

Open FranzForstmayr opened this issue 4 months ago • 2 comments

Is there a way to use pyapp behind a corporate proxy? Currently I get SSL errors, probably because system certs are not used?

Building source distribution...
Building wheel from source distribution...
Successfully built dist\projectplace_api-0.2.0.tar.gz
Successfully built dist\projectplace_api-0.2.0-py3-none-any.whl
Wheel file path: C:\Workspaces\python\projectplace-api\dist\projectplace_api-0.2.0-py3-none-any.whl
       Fresh unicode-ident v1.0.18
       Fresh shlex v1.3.0
       Fresh jobserver v0.1.32
       Fresh pkg-config v0.3.32
       Fresh version_check v0.9.5
       Fresh autocfg v1.4.0
       Fresh cfg-if v1.0.0
       Fresh stable_deref_trait v1.2.0
       Fresh pin-project-lite v0.2.16
       Fresh once_cell v1.21.3
       Fresh proc-macro2 v1.0.94
       Fresh cc v1.2.16
       Fresh bytes v1.10.1
       Fresh futures-core v0.3.31
       Fresh itoa v1.0.15
       Fresh subtle v2.6.1
       Fresh writeable v0.5.5
       Fresh litemap v0.7.5
       Fresh memchr v2.7.4
       Fresh fnv v1.0.7
       Fresh quote v1.0.40
       Fresh windows_x86_64_msvc v0.52.6
       Fresh typenum v1.18.0
       Fresh libc v0.2.171
       Fresh smallvec v1.14.0
       Fresh futures-sink v0.3.31
       Fresh http v1.3.1
       Fresh pin-utils v0.1.0
       Fresh syn v2.0.100
       Fresh windows-targets v0.52.6
       Fresh generic-array v0.14.7
       Fresh slab v0.4.9
       Fresh rustls-pki-types v1.11.0
       Fresh icu_locid_transform_data v1.5.0
       Fresh futures-task v0.3.31
       Fresh futures-io v0.3.31
       Fresh http-body v1.0.1
       Fresh getrandom v0.2.15
       Fresh synstructure v0.13.1
       Fresh zerovec-derive v0.10.3
       Fresh displaydoc v0.2.5
       Fresh icu_provider_macros v1.5.0
       Fresh zeroize_derive v1.4.2
       Fresh windows-sys v0.52.0
       Fresh crypto-common v0.1.6
       Fresh futures-util v0.3.31
       Fresh percent-encoding v2.3.1
       Fresh untrusted v0.9.0
       Fresh icu_properties_data v1.5.0
       Fresh block-buffer v0.10.4
       Fresh zerofrom-derive v0.1.6
       Fresh yoke-derive v0.7.5
       Fresh socket2 v0.5.10
       Fresh mio v1.0.3
       Fresh zeroize v1.8.1
       Fresh zerocopy v0.8.23
       Fresh ring v0.17.14
       Fresh utf8_iter v1.0.4
       Fresh try-lock v0.2.5
       Fresh tower-service v0.3.3
       Fresh utf16_iter v1.0.5
       Fresh write16 v1.0.0
       Fresh icu_normalizer_data v1.5.0
       Fresh zerofrom v0.1.6
       Fresh tokio v1.44.1
       Fresh want v0.3.1
       Fresh rustls-webpki v0.103.0
       Fresh httparse v1.10.1
       Fresh ppv-lite86 v0.2.21
       Fresh digest v0.10.7
       Fresh windows-sys v0.59.0
       Fresh rand_core v0.9.3
       Fresh futures-channel v0.3.31
       Fresh tracing-core v0.1.33
       Fresh aho-corasick v1.1.3
       Fresh yoke v0.7.5
       Fresh utf8parse v0.2.2
       Fresh anstyle v1.0.10
       Fresh regex-syntax v0.8.5
       Fresh tracing v0.1.41
       Fresh rustls v0.23.25
       Fresh hyper v1.6.0
       Fresh rand_chacha v0.9.0
       Fresh zerovec v0.10.4
       Fresh anstyle-wincon v3.0.7
       Fresh regex-automata v0.4.9
       Fresh anstyle-parse v0.2.6
       Fresh zstd-sys v2.0.14+zstd.1.5.7
       Fresh anstyle-query v1.1.2
       Fresh form_urlencoded v1.2.1
       Fresh inout v0.1.4
       Fresh sync_wrapper v1.0.2
       Fresh crc32fast v1.4.2
       Fresh tower-layer v0.3.3
       Fresh tinystr v0.7.6
       Fresh icu_collections v1.5.0
       Fresh log v0.4.26
       Fresh cpufeatures v0.2.17
       Fresh zlib-rs v0.5.1
       Fresh is_terminal_polyfill v1.70.1
       Fresh base64 v0.22.1
       Fresh colorchoice v1.0.3
       Fresh ipnet v2.11.0
       Fresh powerfmt v0.2.0
       Fresh zstd-safe v7.2.3
       Fresh getrandom v0.3.2
       Fresh cipher v0.4.4
       Fresh bzip2-sys v0.1.13+1.0.8
       Fresh regex v1.11.1
       Fresh liblzma-sys v0.4.4
       Fresh tower v0.5.2
       Fresh serde v1.0.219
       Fresh tokio-rustls v0.26.2
       Fresh rand v0.9.1
       Fresh hmac v0.12.1
       Fresh webpki-roots v0.26.8
       Fresh icu_locid v1.5.0
       Fresh hyper-util v0.1.14
       Fresh deranged v0.4.0
       Fresh libz-rs-sys v0.5.1
       Fresh anstream v0.6.18
       Fresh ryu v1.0.20
       Fresh iri-string v0.7.8
       Fresh clap_lex v0.7.4
       Fresh lockfree-object-pool v0.1.6
       Fresh num-conv v0.1.0
       Fresh strsim v0.11.1
       Fresh heck v0.5.0
       Fresh option-ext v0.2.0
       Fresh encode_unicode v1.0.0
       Fresh time-core v0.1.4
       Fresh bumpalo v3.17.0
       Fresh simd-adler32 v0.3.7
       Fresh hashbrown v0.15.2
       Fresh unicode-width v0.2.0
       Fresh bitflags v2.9.0
       Fresh highway v1.3.0
       Fresh equivalent v1.0.2
       Fresh aes v0.8.4
       Fresh zstd v0.13.3
       Fresh liblzma v0.4.2
       Fresh icu_provider v1.5.0
       Fresh portable-atomic v1.11.0
       Fresh dirs-sys v0.5.0
       Fresh flate2 v1.1.2
       Fresh clap_builder v4.5.40
       Fresh time v0.3.40
       Fresh zopfli v0.8.1
       Fresh indexmap v2.8.0
       Fresh console v0.15.11
       Fresh hyper-rustls v0.27.5
       Fresh serde_urlencoded v0.7.1
       Fresh tower-http v0.6.6
       Fresh clap_derive v4.5.40
       Fresh sha1 v0.10.6
       Fresh pbkdf2 v0.12.2
       Fresh bzip2 v0.5.2
       Fresh filetime v0.2.25
       Fresh webpki-roots v1.0.1
       Fresh http-body-util v0.1.3
       Fresh libbz2-rs-sys v0.2.1
       Fresh fastrand v2.3.0
       Fresh constant_time_eq v0.3.1
       Fresh deflate64 v0.1.9
       Fresh unicode-segmentation v1.12.0
       Fresh number_prefix v0.4.0
       Fresh fs4 v0.13.1
       Fresh icu_locid_transform v1.5.0
       Fresh bzip2 v0.6.0
       Fresh anyhow v1.0.98
       Fresh indicatif v0.17.11
       Fresh tempfile v3.20.0
       Fresh tar v0.4.44
       Fresh directories v6.0.0
       Fresh clap v4.5.40
       Fresh zip v4.2.0
       Fresh os_pipe v1.2.2
       Fresh icu_properties v1.5.1
       Fresh icu_normalizer v1.5.0
       Fresh idna_adapter v1.2.0
       Fresh idna v1.0.3
       Fresh url v2.5.4
       Fresh reqwest v0.12.21
       Dirty pyapp v0.28.0 (C:\Workspaces\python\projectplace-api\pyapp-latest): the precalculated components changed
   Compiling pyapp v0.28.0 (C:\Workspaces\python\projectplace-api\pyapp-latest)
     Running `C:\Workspaces\python\projectplace-api\pyapp-latest\target\release\build\pyapp-a4169a941c6a4c54\build-script-build`
error: failed to run custom build command for `pyapp v0.28.0 (C:\Workspaces\python\projectplace-api\pyapp-latest)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `C:\Workspaces\python\projectplace-api\pyapp-latest\target\release\build\pyapp-a4169a941c6a4c54\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-env=PYAPP_PROJECT_DEPENDENCY_FILE=
  cargo:rustc-env=PYAPP__PROJECT_DEPENDENCY_FILE_NAME=
  cargo:rustc-env=PYAPP_PROJECT_NAME=projectplace-api
  cargo:rustc-env=PYAPP_PROJECT_VERSION=0.2.0
  cargo:rustc-env=PYAPP__PROJECT_EMBED_FILE_NAME=projectplace_api-0.2.0-py3-none-any.whl

  --- stderr

  thread 'main' panicked at build.rs:641:14:
  called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: "https://github.com/astral-sh/python-build-standalone/releases/download/20250712/cpython-3.13.5%2B20250712-x86_64-pc-windows-msvc-install_only_stripped.tar.gz", source: hyper_util::client::legacy::Error(Connect, Custom { kind: Other, error: Custom { kind: InvalidData, error: InvalidCertificate(UnknownIssuer) } }) }
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\panicking.rs:697
     1: core::panicking::panic_fmt
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\core\src\panicking.rs:75
     2: core::result::unwrap_failed
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\core\src\result.rs:1732
     3: build_script_build::set_project::{{closure}}
     4: build_script_build::set_execution_mode::{{closure}}
     5: core::ops::function::FnOnce::call_once
     6: std::rt::lang_start::{{closure}}
     8: std::rt::lang_start_internal::closure$0
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\rt.rs:168
     9: std::panicking::try::do_call
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\panicking.rs:589
    10: std::panicking::try
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\panicking.rs:552
    11: std::panic::catch_unwind
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\panic.rs:359
    12: std::rt::lang_start_internal
               at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\rt.rs:164
    13: std::rt::lang_start
    14: main
    15: invoke_main
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    16: __scrt_common_main_seh
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    17: BaseThreadInitThunk
    18: RtlUserThreadStart
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

FranzForstmayr avatar Aug 12 '25 08:08 FranzForstmayr

If the distribution is not built in, I get the following error:

PS C:\Workspaces\python\materialcenter-import> .\mc_batch_import.exe -v
Error: download failed: https://github.com/astral-sh/python-build-standalone/releases/download/20250712/cpython-3.13.5%2B20250712-x86_64-pc-windows-msvc-install_only_stripped.tar.gz

Caused by:
    0: error sending request for url (https://github.com/astral-sh/python-build-standalone/releases/download/20250712/cpython-3.13.5%2B20250712-x86_64-pc-windows-msvc-install_only_stripped.tar.gz)
    1: client error (Connect)
    2: invalid peer certificate: UnknownIssuer

FranzForstmayr avatar Aug 21 '25 08:08 FranzForstmayr

Hey @FranzForstmayr. I found a solution:

  1. Configure cargo to work behind a proxy following configure cargo
  2. replace the code in https://github.com/ofek/pyapp/blob/651091f99beee8a6fd4145df58f0d3eddffdfabf/build.rs#L640
let bytes = reqwest::blocking::get(&distribution_source).unwrap().bytes().unwrap();

with the following

let client = reqwest::blocking::Client::builder()
  .danger_accept_invalid_certs(true)
  .build()
  .unwrap();

let bytes = client.get(&distribution_source)
  .send()
  .unwrap()
  .bytes()
  .unwrap();

Hope this will work also for you.

8greg8 avatar Aug 28 '25 08:08 8greg8

Thanks that helped for now, but I assume this is no general solution.

FranzForstmayr avatar Nov 26 '25 17:11 FranzForstmayr