wayscript / feedback

We would love to hear from you!
8 stars 1 forks source link

Running a python code with a daily trigger isn't re-running the python code #4

Closed Nirose closed 5 years ago

Nirose commented 5 years ago

Describe the bug Running a python code with a daily trigger isn't actually running the python code. It is just using the output generated on the last "code run" (that plays the python code) for every run.

To Reproduce Steps to reproduce the behavior:

  1. Create a python code to scrape a forex API
import requests
import json
url = 'https://www.freeforexapi.com/api/live?pairs=USDNPR'

r = requests.get(url)

data = json.loads(r.text)
if (data['code'] == 200):
    message = str(data['rates']['USDNPR']['rate'])

outputs['message'] = message
  1. Make the output be sent via email with daily trigger
  2. Test the flow to see if it works. It works and gets the rate
  3. But everyday it sends the same exchange rate even though the API response has different rates, so it's not really running the python code?

Expected behavior It should run the code every time it is triggered, but it seems, it is using the same output from the last "code run"

Screenshots email sent

Additional context I just went to the flow to run the code again. it had the same output for 3 days. ran the code again to get an updated response

jeffbuswell commented 5 years ago

Hey @Nirose, thanks for reporting this issue. We are unable to reproduce the behavior you are seeing, but there are a couple things you can try:

  1. If data['code'] != 200, message won't have a value, so you might want to assign a default value in that case
  2. You can try hitting "Duplicate" on your program to create a fresh copy, and then delete the old one. See if this copy has the same issue. Duplicate

Please let us know if either of these things work for you, or if you still see the same behavior.

jeffbuswell commented 5 years ago

@Nirose I'm going to close this issue, but feel free to reach back out if you are still having issues.