I've have a GitHub app which uses a jwt that can expire. Ultimately, I generate an installation access token that can also expire and I am trying to use ghapi with that installation access token.
I was hoping that I could subclass GhApi.__call__ to dynamically generate my access token, but this does not seem to work.
IatManager.headers() will generate a new jwt token whenever it is expired and then will use this to generate an access token for the specified installation id. The headers it generates look like this:
In [5]: iatm.headers(2)
Out[5]:
{'Authorization': 'token ghs_randomstuffhere',
'Accept': 'application/vnd.github.v3+json'}
The reason that this did not work is that ultimately GhApi.__call__ is not what was called. Rather it was some lower level thing. Any suggestion on how I can use ghapi for a long-running GitHub app where the headers need to be dynamically updated in time?
I've have a GitHub app which uses a jwt that can expire. Ultimately, I generate an installation access token that can also expire and I am trying to use
ghapi
with that installation access token.I was hoping that I could subclass
GhApi.__call__
to dynamically generate my access token, but this does not seem to work.IatManager.headers() will generate a new jwt token whenever it is expired and then will use this to generate an access token for the specified installation id. The headers it generates look like this:
The reason that this did not work is that ultimately
GhApi.__call__
is not what was called. Rather it was some lower level thing. Any suggestion on how I can useghapi
for a long-running GitHub app where the headers need to be dynamically updated in time?