akarneliuk / pygnmi

The pure Python implementation of the gNMI client.
https://training.karneliuk.com
BSD 3-Clause "New" or "Revised" License
129 stars 44 forks source link

Add proxy support #133

Closed XioNoX closed 1 year ago

XioNoX commented 1 year ago

For troubleshooting purposes we need to run our automation (and thus pygnmi) from our laptop instead of prod servers.

GRPC supports the "grpc_proxy" env-var out of the box, but pygnmi does additional certificate verification. Unfortunately ssl.get_server_certificate doesn't support proxies, so we have to handle it at lower level (the code is greatly inspired by https://stackoverflow.com/questions/53587700).

You can then use it with for example: grpc_proxy=http://proxy:8080 python3 test-gnmi3.py