Hi
I have a Python step in between two Google Sheets steps in a workflow that has been working perfectly since December 2022. At the end of April 2023, the workflow stopped working. Since I only learned enough code to get this set up, I’m having trouble figuring out the issue and how to fix it. The only thing that stood out to me is that the syntax for passing information between steps has changed. However, when I checked the documentation, they still have the old syntax up.
I’m attaching what my Python step looks like, the full error I get, and the Github page for the package I’m using. Thanks for any guidance!
from pipedream.script_helpers import (steps, export)
from ao3 import AO3
import requests
from bs4 import BeautifulSoup as bs
api = AO3()
import pytest
from ao3 import utils
@pytest.mark.parametrize('url, work_id', [
('https://archiveofourown.org/works/1', '1'),
('https://archiveofourown.org/works/1234567', '1234567'),
('https://archiveofourown.org/works/1?view_adult=true', '1'),
('https://archiveofourown.org/works/1234567?view_adult=true', '1234567'),
('http://archiveofourown.org/works/1?view_adult=true', '1'),
('http://archiveofourown.org/works/1234567?view_adult=true', '1234567'),
])
def test_work_id_from_url(url, work_id):
assert utils.work_id_from_url(url) == work_id
@pytest.mark.parametrize('bad_url', [
'http://google.co.uk',
'http://archiveofourown.org/users/username',
])
def test_work_id_from_bad_url_raises_runtimeerror(bad_url):
"""Trying to get a work ID from a non-work URL raises a RuntimeError."""
with pytest.raises(RuntimeError) as exc:
utils.work_id_from_url(bad_url)
assert 'not a recognised AO3 work URL' in exc.value.message
read_fic = steps["trigger"]["event"]["changes"][1]["new_value"]
work = api.work(read_fic)
url = 'https://archiveofourown.org/works/'
r = requests.get(url)
soup = bs(r.content, 'html.parser')
info = work.url, work.title, work.author, work.rating, work.fandoms, work.relationship, work.additional_tags, work.words
export('Title', str(work.title))
export('Author', str(work.author))
target = {39:None, 91:None , 93:None}
export('Fandom', str(work.fandoms).translate(target))
export('Ship', str(work.relationship).translate(target))
export('Category', str(work.category).translate(target))
export('Word Count', int(work.words))
export('Rating', str(work.rating).translate(target))
export('Tags', str(work.additional_tags).translate(target))
export('URL', str(work.url))