pygraphistry
pygraphistry copied to clipboard
[BUG] missing user/pass for register() results in KeyError: 'org_name' in plot()
Describe the bug
missing user/pass is not failing on register(), but results in KeyError: 'org_name' on plot() call
To Reproduce
import pandas as pd
graphistry.register(api=3,
protocol = "http",
server = "nginx",
username = os.getenv("NON_EXISTENT_ENVAR"),
password = os.getenv("NON_EXISTENT_ENVAR")
)
edf = pd.read_csv('https://raw.githubusercontent.com/graphistry/pygraphistry/master/demos/data/honeypot.csv')
graphistry.edges(edf, 'attackerIP', 'victimIP').plot()
Expected behavior expect register to fail or warn
Actual behavior
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[8], line 4
1 n_nodes=50 * 1000
2 n_edges=1000
----> 4 create_and_plot_df(n_nodes, n_edges)
Cell In[7], line 31, in create_and_plot_df(n_nodes, n_edges, n_df, e_df)
28 if e_df is None:
29 e_df = create_edge_df(n_nodes, n_edges)
---> 31 plot_url(n_df, e_df)
Cell In[7], line 9, in plot_url(n_df, e_df)
6 g = graphistry.nodes(n_df, 'ID').edges(e_df,'src', 'dest').get_degrees()
7 print(f'avg_degree = {round(g._nodes["degree"].sum()/len(g._nodes),2)}')
----> 9 url = SERVER + g.plot(render=False)
10 time_taken = timeit.default_timer() - starttime
11 #print(f'Time taken generate viz url: {str(round(time_taken/60,2))} mins')
File /opt/conda/envs/rapids/lib/python3.8/site-packages/graphistry/PlotterBase.py:1401, in PlotterBase.plot(self, graph, nodes, name, description, render, skip_upload, as_files, memoize, extra_html, override_html_style)
1399 elif api_version == 3:
1400 logger.debug("3. @PloatterBase plot: PyGraphistry.org_name(): {}".format(PyGraphistry.org_name()))
-> 1401 PyGraphistry.refresh()
1402 logger.debug("4. @PloatterBase plot: PyGraphistry.org_name(): {}".format(PyGraphistry.org_name()))
1404 dataset = self._plot_dispatch(g, n, name, description, 'arrow', self._style, memoize)
File /opt/conda/envs/rapids/lib/python3.8/site-packages/graphistry/pygraphistry.py:359, in PyGraphistry.refresh(token, fail_silent)
357 """Use self or provided JWT token to get a fresher one. If self token, internalize upon refresh."""
358 using_self_token = token is None
--> 359 logger.debug("1. @PyGraphistry refresh, org_name: {}".format(PyGraphistry._config['org_name']))
360 try:
361 if PyGraphistry.store_token_creds_in_memory():
KeyError: 'org_name'
@vaimdev Including on your plate next time we look at these
yes, noted.