Using Gro API behind a Corporate Proxy

The Gro API uses the requests package to communicate with the Gro Servers. If you are behind a corporate proxy, you may see the error message below:

requests.exceptions.ProxyError: HTTPSConnectionPool … (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

Set an Environment Variable

Note

The variables in the examples below should be replaced with the actual values for your environment.

Windows

To change environment variables on Windows:

  1. In the Start menu, search for “env”.

  2. Select “Edit Environment Variables for your account”

  3. Select “Environment Variables…”

  4. Press “New…”

  5. Add two variables http_proxy and https_proxy both with the same value depending on the type of proxy:

  1. Unauthenticated Proxy:

http_proxy="http://your-proxy-domain:<port>"
https_proxy="http://your-proxy-domain:<port>"
  1. Authenticated Proxy:

http_proxy="http://username:password@corp.com:<port>"
https_proxy="http://username:password@corp.com:<port>"

MacOS / Linux

You can set an environment variable for temporary or permanent use. If you need a variable for just one time, you can set it up using terminal.

  1. Temporarily change the environment variables by running export variable_name=variable_value from the terminal prompt depending on the type of proxy:

  1. Unauthenticated Proxy:

export http_proxy="http://your-proxy-domain:<port>"
export https_proxy="http://your-proxy-domain:<port>"
  1. Authenticated Proxy:

export http_proxy="http://username:password@corp.com:<port>"
export https_proxy="http://username:password@corp.com:<port>"
  1. Permanently change the environment variables in MacOS. For permanent setting, you need to understand where to put the “export” command. This is determined by what shell you are using. You can check this by running the following command: echo $SHELL

For /bin/bash you should edit ~/.bash_profile.
For /bin/zsh, you should edit ~/.zshrc.
  1. Unauthenticated Proxy:

export http_proxy="http://your-proxy-domain:<port>"
export https_proxy="http://your-proxy-domain:<port>"
  1. Authenticated Proxy:

export http_proxy="http://username:password@corp.com:<port>"
export https_proxy="http://username:password@corp.com:<port>"