Code Monkey home page Code Monkey logo

Comments (4)

soranoo avatar soranoo commented on May 29, 2024

May I see your code?

from tradingview-free-webhook-alerts.

OmarSaidIbrahim avatar OmarSaidIbrahim commented on May 29, 2024
# =====================================
# CODE
# =====================================

flag = True
last_message = None

url_regex = "https?://([A-Za-z_0-9.-]+).*"

...

def handler(pd: "pipedream"):   
    # extract data from previous steps
    global flag
    global last_message
    
    content = pd.steps["trigger"]["event"]["body"]["text"]
    from_email = pd.steps["trigger"]["event"]["headers"]["from"]["value"][0]["address"]
    now = datetime.utcnow()
    current_time = now.strftime("%H:%M")
    today_0800pm_UTC = datetime.strptime("20:00", "%H:%M").strftime("%H:%M")
    today_0230pm_UTC = datetime.strptime("14:30", "%H:%M").strftime("%H:%M")
    if last_message != None and has_new_day_started(last_message, now):
        flag = True
    if current_time > today_0230pm_UTC and current_time < today_0800pm_UTC:
        if flag:
            send_webhook(content)
            flag = False
            last_message = now

@soranoo

from tradingview-free-webhook-alerts.

soranoo avatar soranoo commented on May 29, 2024

Pipedream will stop the script after a certain time, it also means no variables can be saved.
If you really want to save something for future use you may check out Data Stores. Notice that the feature is still in beta.

from tradingview-free-webhook-alerts.

OmarSaidIbrahim avatar OmarSaidIbrahim commented on May 29, 2024

Thank you so much, that helped me a lot

from tradingview-free-webhook-alerts.

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.