-
Notifications
You must be signed in to change notification settings - Fork 2
✨ Adding multipass function #8
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ponty33 Can this be completed? What's left?
Co-authored-by: Anthony Hillairet <ant@satel.ca>
Copy your README.md to docs/index.md to fix the test. |
@lishanl This could be useful. Do you mind looking at it to to see if it fits the rest of the code. I think multipass needs its own section in the docs so it appears clearly in the menu on the left. |
I think I can work on it, good start for me to be involved in Spylib |
@lishanl Is there a way to preview the doc? |
start your mkdocs locally to check https://satelcreative.github.io/spylib/development-contributing/#build-and-run-documentation-lazydocsmkdocs @ponty33 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Frank for adding and completing this feature 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lishanl @ponty33 Let's talk about the design.
Is there a reason to have a class?
I would prefer a set of functions instead:
def generate_token(secret: str, contact_raw_data: Dict[str, Any]) -> bytes:
 ...

def generate_url(secret: str, contact_raw_data: Dict[str, Any], url: str) -> str:
...
The docs could show how to use partial to avoid passing around the secret.
The user can still have multipass.
:
from spylib import multipass
url = multipass.generate_url(...
The small helper functions should start with _
(that applies to internal methods too):
def _get_keys(secret: str) -> Tuple[str, str]:
key = SHA256.new(secret.encode('utf-8')).digest()
 return (key[0:16], key[16:32])
Bonus point if you use a dataclass or a pydantic model instead of a Tuple! 😉
OOP VS Functional programming 🥁 |
@lishanl Well maybe ... is "multipass" really an object though? |
There wasn't much reason behind it. The code was referenced from an unmaintained repo, and it was written in class I don't have much opinion on it, either way is fine to me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ponty33 Let's go with functions here please. No reason for a class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the email is a required field and the only required field in the customer data dict. Please add a check so that SPyLib fails with a meaningful error message before the user makes the multipass API call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am picking on the consistency here. 😅 Hope you don't mind Frank. It would be nice to have type annotations for all functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused thing. Otherwise looks great.
Finally closed after 329 days 😄 |
Definitely top 1 on the leaderboard for the longest open PR that actually gets completed at the end. 🏆 |
I miss PullPanda for that! The listing of records and averages was great! |
Changes
Multipass
class to generate multipass token or URL