<jupyter_start><jupyter_text>OverviewThis notebook guides you through process of testing if the Jupyter Notebook server is authorized to access the Earth Engine servers, and provides a way to authorize the server, if needed.  Testing if the Jupyter Notebook server is authorized to access Earth EngineTo begin, first verify that you can import the Earth Engine Python API package by running the following cell.<jupyter_code>import ee<jupyter_output><empty_output><jupyter_text>Next, try to initialize the `ee` Python package.<jupyter_code>try:
  ee.Initialize()
  print('The Earth Engine package initialized successfully!')
except ee.EEException as e:
  print('The Earth Engine package failed to initialize!')
except:
    print("Unexpected error:", sys.exc_info()[0])
    raise<jupyter_output><empty_output><jupyter_text>If the initialization succeeded, you can stop here. Congratulations! If not, continue on below...  Authenticating to the Earth Engine servers If the initialization process failed, you will need to authenticate the Jupyter Notebook server so that it can communicate with the Earth Engine servers. You can initiate the authentication process by running the following command.*Note that `earthengine authenticate` is a system command (rather than a Python command), and the cell uses the [%%bash cell magic](http://ipython.readthedocs.io/en/stable/interactive/magics.htmlcellmagic-bash) in the first line of the cell to indicate that the cell contents should be executed using a bash shell.*<jupyter_code>%%bash
earthengine authenticate --quiet<jupyter_output><empty_output><jupyter_text>Once you have obtained an authorization code from the previous step, paste the code into the following cell and run it.<jupyter_code>%%bash
earthengine authenticate --authorization-code=<authcode><jupyter_output><empty_output><jupyter_text>Removing authentication credentialsAuthenication credentials are stored as a file in the user's configuration directory. If you need to remove the authentication credentials, run the following cell.<jupyter_code>%%bash
rm ~/.config/earthengine<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06512505899008966, 'fraction_numerical': 0.00047192071731949034, 'mean_word_length': 6.335640138408304, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '295893', 'license': 'MIT', 'n_tokens_mistral': 570, 'n_tokens_neox': 548, 'n_words': 239, 'path': 'data/gee_auth/.ipynb_checkpoints/authorize_notebook_server-checkpoint.ipynb', 'repo_name': 'Skydipper/jupyterlab', 'size': '2119'}