2

I'm accessing the Coinbase PRO API and it needs three things, the API public key, the API secret, and the API password. I am able to successfully save the key and password because they are only strings with alphabetic characters. However, the API secret is something like this: "uoahdsgoaogdso==" It appears that the equals signs at the end are preventing the system from recognizing the variable.

In python I use the following command to print each environment variable (replacing key with each parameter above): print(os.getenv('key'))

When I run the above, I can successfully print the public key and password but when I attempt to print the API secret, it gives me an empty string. Any thoughts on why it won't save a string which contains ==

Here is a visual representation of the issue

Another note, I am using the Ubuntu, the linux subsystem for windows

CyK
  • 31
  • 3

1 Answers1

-1

There is nothing special about the string == as far as environment variables are concerned. An ASCII equal-sign char is no different from any other printable character; e.g., the ASCII letter u. You can see that this is true by a simple experiment:

$ bash
==== Hello from .bashrc ====
bash-5.0$ export KEY=abc=
bash-5.0$ env | grep KEY
KEY=abc=
bash-5.0$ bash -c 'echo "|$KEY|"'
|abc=|
bash-5.0$

Trailing equal-sign chars are special, however, in specific contexts such as printable base64 encoded RSA keys where they are used for padding to ensure a valid base64 string. See, for example, Why does a base64 encoded string have an = sign at the end.

Also, by "conda" are you referring to the Anaconda platform for Python based numerical analysis? If yes I am perplexed by your question. The use of Anaconda to run a Python program will have absolutely no effect on the behavior of environment variables.

Kurtis Rader
  • 6,734
  • 13
  • 20