View Category

Check your language appears on the langref.org site

Your language name should appear within the HTML found at the http://langreg.org main page.
python
from urllib import urlopen
print urlopen('http://langref.org').read().find('python') >= 0 and 'found' or 'not found'

Send an email

Use library functions, classes or objects to create a short email addressed to your own email address. The subject should be, "Greetings from langref.org", and the user should be prompted for the message body, and whether to cancel or proceed with sending the email.
python
import smtplib
import locale

from email.mime.text import MIMEText

encoding = locale.getpreferredencoding()

def main():
smtp_servername = "smtp.example.com"

from_addr = "ernie@example.com"
to_addr = "cookie.monster@mailinator.com"

body = raw_input("Enter the email message ")
if not raw_input("Send email? y/N ") in ["y", "Y"]:
print "aborting"
return

message = MIMEText(body, _charset=encoding)

message["From"] = from_addr
message["To"] = to_addr
message["Subject"] = "Greetings from langref.org"

server = smtplib.SMTP(smtp_servername)
server.sendmail(from_addr, to_addr, message.as_string())


if __name__ == "__main__":
main()