pyTigerGraph - Initialize connection

This is a workflow question.

(Disclaimer - I’m new to Python and am writing a connector in c# where things work a little differently).

In the initialization method (init) the last parameter we pass in is the token, however, first we must fetch the token using the secret. Logic tells me we would pass in the secret here and not the token. I see there are other methods for fetching/refreshing the token.

In the c# world we would pass parameters into the constructor as we create an instance of the TigerGraphConnection class and therefore we would be passing in the secret and not he token. The class constructor could then fetch the token and persist it as a private class variable eliminating the need to pass the token into any other methods of the TigerGraphConnection API.

The TigerGraphConnection class public API would not need a public method to GetToken, but could have a public RefreshToken method needing only a “lifeTime” parameter.

Am I missing anything here?

Thank you.

1 Like

Your approach sounds like a good one.

I’m not deeply familiar with pyTigerGraph, but I know the direct TigerGraph APIs pretty well. My guess is that pyTigerGraph is following closely the direct TigerGraph API, which is not object oriented.

1 Like

@VictorLee is right, the pyTigerGraph approach closely follows the REST API.
In C#, if you intend to implement the connector as a class, could you maybe implement the token management functions as class (or static) functions (i.e. ones that do not require instantiation of the class)?

1 Like