0

Problem:

Currently, I am trying to build a demo app in which a python process is executed through API and it further invokes API

Requirements:

  1. A .NET Core Web API (a) which is protected through OAuth2 scope protection invokes python process
  2. Python code executes and sends call to another .NET Core Web API (b) also protected or some .NET C# function that returns data to python code
  3. API b sends back data to python process
  4. Python process perform task

Restraints:

  1. No use of inter-process communication
  2. The important thing is the API a and b are protected through scope which is verified suing access_token in Identity Server 4

Goal:

Protect endpoints through IdentityServer4 scope and train machine learning model on data provided by API and return inference

Extras:

Can I use pythonnet for communication between python and .NET Core Web API projects?

ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
  • Hi @Salahuddin, Please can you be more specific on what is and isn't working, what you've done so far and what you're stuck on. Thanks. Also, if this is a homework assignment, you may find [This article](https://meta.stackoverflow.com/q/334822) helpful – Naftoli Ost Dec 23 '21 at 10:55
  • @NaftoliOst I am not sure how to even proceed since this is my first exposure to .NET core Web API. What I need is somehow execute python code from .NET API and pass it access token so that it can talk to the other .NET API which will first validate the scope for token whether that user is allowed to enter this API – Shisui Otsutsuki Dec 23 '21 at 11:15
  • it is not homework. A personal project – Shisui Otsutsuki Dec 23 '21 at 12:05
  • It might be easiest to first get this working in c#. No Python - just a separate .net process, so you have a two-process setup similar to what you want to do with Python (if I understand you correctly). I'm thinking that should be easier to find examples of / get help with. Once that works, it shouldn't be hard to invoke the needed API from python, using Python.net. (I don't have expertise re .net core, so I can't help with that.) – ToolmakerSteve Jan 07 '22 at 01:09

0 Answers0