Code Monkey home page Code Monkey logo

Comments (5)

jshcodes avatar jshcodes commented on May 24, 2024

Hi @RoemIko -

Thank you for reporting this issue!

We have confirmed this issue as a bug, and have a fix ready for the 1.4.3 version. In the interim, here is a work around leveraging the Uber Class that should also accomplish what you are trying to do.

from os import listdir
from falconpy import APIHarnessV2


def import_workflows():
    path_to_workflows_folder = "/home/REDACTED/workflows/

    falcon_w = APIHarnessV2(client_id=CLIENT_ID,
                            client_secret=CLIENT_SECRET
                            )

    for filename in listdir(path_to_workflows_folder):
        if filename.endswith(".yaml") or filename.endswith(".yml"):
            print(f'Importing {filename}')
            with open(f'{path_to_workflows_folder + filename}', 'r') as yaml_file:
                file_data = {"data_file": yaml_file.read(), "type": "application/x-yaml"}
                workflow_response = falcon_w.command("WorkflowDefinitionsImport", files=file_data)
                print(f'Workflow Response: {workflow_response}')
                if workflow_response['status_code'] == 200:
                    print(f'Workflow {filename} imported successfully')
                else:
                   print(f'Workflow {filename} failed to import')

from falconpy.

RoemIko avatar RoemIko commented on May 24, 2024

Hi @jshcodes,

Thank you for looking into it 🙏 , and many thanks for the workaround

from falconpy.

RoemIko avatar RoemIko commented on May 24, 2024

I have updated falconpy to 1.4.3 but now i receive an error 500 with "Keyword arguments are required to use this method." This happens when i use the initial code from the beginning of this thread

from falconpy.

jshcodes avatar jshcodes commented on May 24, 2024

Can we see your call to import_definition? It still just includes the data_file argument?

from falconpy.

RoemIko avatar RoemIko commented on May 24, 2024

Yes it still includes the data_file argument

from os import listdir

def import_workflows():
    path_to_workflows_folder = "/home/REDACTED/workflows/

    falcon_w = Workflows(client_id=CLIENT_ID,
                   client_secret=CLIENT_SECRET
                   )

    for filename in listdir(path_to_workflows_folder):
        if filename.endswith(".yaml") or filename.endswith(".yml"):
            print(f'Importing {filename}')
            with open(f'{path_to_workflows_folder + filename}', 'r') as yaml_file:
                workflow_response = falcon_w.import_definition(data_file=yaml_file)
                print(f'Workflow Response: {workflow_response}')
                if workflow_response['status_code'] == 200:
                    print(f'Workflow {filename} imported successfully')
                else:
                   print(f'Workflow {filename} failed to import')

from falconpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.