Spaces:
Running
Running
Peter
commited on
Commit
•
b1deccc
1
Parent(s):
b97cc67
:zap: add email link generator
Browse files
utils.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
"""
|
4 |
import logging
|
5 |
|
|
|
6 |
def postprocess(text: str):
|
7 |
"""
|
8 |
postprocess - remove common values in scraped dataset
|
@@ -40,3 +41,25 @@ def clear(text, verbose=False, **kwargs):
|
|
40 |
if verbose:
|
41 |
logging.info(f"Clearing text: {text}")
|
42 |
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
"""
|
4 |
import logging
|
5 |
|
6 |
+
|
7 |
def postprocess(text: str):
|
8 |
"""
|
9 |
postprocess - remove common values in scraped dataset
|
|
|
41 |
if verbose:
|
42 |
logging.info(f"Clearing text: {text}")
|
43 |
return ""
|
44 |
+
|
45 |
+
|
46 |
+
def make_email_link(
|
47 |
+
subject:str="Email subject - This was generated by Postbot",
|
48 |
+
link_text:str="click to open in your email client",
|
49 |
+
body:str=None,
|
50 |
+
):
|
51 |
+
"""
|
52 |
+
email_link - generate an email link
|
53 |
+
|
54 |
+
Args:
|
55 |
+
subject (str, optional): the subject of the email. Defaults to "Email subject - This was generated by Postbot".
|
56 |
+
link_text (str, optional): the text of the link. Defaults to "click to open in your email client".
|
57 |
+
body (_type_, optional): the body of the email. Defaults to None.
|
58 |
+
|
59 |
+
Returns:
|
60 |
+
str: the email link
|
61 |
+
"""
|
62 |
+
|
63 |
+
if body is None:
|
64 |
+
body = "hmm - no body. replace me"
|
65 |
+
return f'<a href="mailto:%20?subject={subject}&body={body}">{link_text}</a>'
|