Skip to main content
Question

PythonCaller rest API using oauth2 web connection

  • March 5, 2020
  • 1 reply
  • 100 views

Hi,

I'm trying to call an API endpoint using PythonCaller but this endpoint requires authentication.

I made it work by first (in the init) connect to the web connection and get the token than send it to the def input and used the token in the header of my endpoint call.

My question is: is there a way to get this token from one of my web connection set in the Tools->FME Options->Web Connections (or either from a published parameter configured with one of them)?

 

The idea is to use the PythonCaller as a HTTPCaller which uses Authentication

 

thank you

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

david_r
Celebrity
  • March 6, 2020

As far as I know, there is no way of retrieving the tokens etc from the FME Web Connections.

If you want to do OAuth from Python in FME, you may want to look into using some of the existing modules that will handle the brunt of the work for you: https://oauth.net/code/python/

My first instinct would be to use the excellent Requests module with the corresponding OAuth libraries.

This would enable you to get your own OAuth token and to use it for the subsequent API calls.