Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opt out phones in EA use case and sample script #670

Merged
merged 22 commits into from
Dec 28, 2022
Merged

Opt out phones in EA use case and sample script #670

merged 22 commits into from
Dec 28, 2022

Conversation

mkwoods927
Copy link
Contributor

This PR adds a new use case and sample script for opting out phone numbers in EveryAction.

@mkwoods927 mkwoods927 added the sample script Work type - writing or changing Parsons sample scripts label Apr 22, 2022
@mkwoods927
Copy link
Contributor Author

@shaunagm I'm worried about line 121 in the sample script because I've been told it's not best practice to do a literal eval like that, but I'm also not sure how else to accomplish what that line does! If you have suggestions I'd love to hear. Thanks!

Copy link
Collaborator

@shaunagm shaunagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I do have a bunch of relatively minor suggestions. The main issue I had reading the sample script was in understanding what schema.tables were. I also made a suggestion about restructuring the attempt_optout function that may or may not be necessary—I'm not sure if my instinct that using multiple return statements is more readable, is correct.

docs/use_cases/opt_outs_to_everyaction.rst Outdated Show resolved Hide resolved
docs/use_cases/opt_outs_to_everyaction.rst Outdated Show resolved Hide resolved
useful_resources/sample_code/README.md Outdated Show resolved Hide resolved
useful_resources/sample_code/opt_outs_everyaction.py Outdated Show resolved Hide resolved
useful_resources/sample_code/opt_outs_everyaction.py Outdated Show resolved Hide resolved
useful_resources/sample_code/opt_outs_everyaction.py Outdated Show resolved Hide resolved
)
raise Exception(f"Connection Error {r}")

return r
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be misunderstanding the construction of the function, but it feels like you can use return directly within the try statement and the two except loops, rather than storing the response as a variable in each segment then returning at the end of the function. I think that's more clear?

useful_resources/sample_code/opt_outs_everyaction.py Outdated Show resolved Hide resolved
useful_resources/sample_code/opt_outs_everyaction.py Outdated Show resolved Hide resolved
@mkwoods927
Copy link
Contributor Author

Ok @shaunagm I think this is all set! It looks like the CircleCI tests failed on an error in an unrelated test, but let me know if there's something I should change here!

@shaunagm
Copy link
Collaborator

shaunagm commented Dec 1, 2022

I suspect that if you rebase, that unrelated error will go away. Have you ever rebased something before? According to the docs there should be a rebase branch button somewhere but I can't find it, so we may need to do this manually.

@mkwoods927
Copy link
Contributor Author

It looks like that option might not be enabled for this repo!

Screen Shot 2022-12-01 at 6 59 13 PM

@mkwoods927
Copy link
Contributor Author

@shaunagm I am seeing a message saying "this branch has no conflicts with the base branch" and it looks like squash and merge is clickable though

@shaunagm
Copy link
Collaborator

shaunagm commented Dec 8, 2022

I was able to rebase the PR for you @mkwoods927 but it looks like there are still some linting issues:

useful_resources/sample_code/opt_outs_everyaction.py:18:14: F821 undefined name 'json'
useful_resources/sample_code/opt_outs_everyaction.py:51:101: E501 line too long (104 > 100 characters)
useful_resources/sample_code/opt_outs_everyaction.py:66:20: F821 undefined name 'ea'
useful_resources/sample_code/opt_outs_everyaction.py:67:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:76:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:90:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:106:101: E501 line too long (113 > 100 characters)
useful_resources/sample_code/opt_outs_everyaction.py:116:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:128:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:146:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:150:1: W293 blank line contains whitespace
useful_resources/sample_code/opt_outs_everyaction.py:164:101: E501 line too long (102 > 100 characters)

Can you fix these? I forget whether we went over linting together, let me know if you need any help. (Also apologies that we've yet to implement automatic linting with Black.)

@mkwoods927
Copy link
Contributor Author

mkwoods927 commented Dec 8, 2022 via email

@mkwoods927
Copy link
Contributor Author

@shaunagm I think I've got all the linting issues fixed! For some reason the docs-build part of the test is failing, but I don't understand the error. Is this something I need to resolve?

Error: [Errno 2] No such file or directory: '/home/circleci/project/venv/bin/python3'

@shaunagm
Copy link
Collaborator

shaunagm commented Dec 17, 2022

Hmm, I suspect the issue is something like this one and someone from TMC needs up update the CircleCI configuration (maybe by updating/"bursting" the Cache keys? whatever that means). Tagging @neverett to get this on their radar.

Definitely not anything for you to worry about @mkwoods927.

@shaunagm shaunagm merged commit d41e9e6 into main Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sample script Work type - writing or changing Parsons sample scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants