<commit_before>package app

import (
	"appengine"
	"appengine/datastore"
	"ebird"
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"io"
	"io/ioutil"
	"regexp"
)

const (
	feedPrefix = "/user/"
)

func init() {
	http.HandleFunc(feedPrefix, serveFeed)
	http.HandleFunc("/debug", debug)
}

type User struct {
	Login string `datastore:",noindex"`
	Password string `datastore:",noindex"`
}

func userKey(context appengine.Context, login string) *datastore.Key {
	return datastore.NewKey(context, "User", login, 0, nil)
}

func serveFeed(w http.ResponseWriter, r *http.Request) {
	login, err := parseUser(r.URL.Path)
	if (err != nil) {
		http.NotFound(w, r)
		return
	}

	context := appengine.NewContext(r)

	user := new(User)
	err = datastore.Get(context, userKey(context, login), user)
	if err != nil {
		log(w, err)
		return
	}

	log(w, user.Login)

	client := ebird.NewClient(context)

	form := url.Values{}
	form.Set("j_username", user.Login)
	form.Set("j_password", user.Password)
	form.Set("cmd", "login")
	resp, err := client.PostForm("https://ebird.org/ebird/j_acegi_security_check", form)
	if (err != nil) {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return<commit_msg>Rename Password to ObfuscatedPassword and add comments.<commit_after>package app

import (
	"appengine"
	"appengine/datastore"
	"ebird"
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"io"
	"io/ioutil"
	"regexp"
)

const (
	feedPrefix = "/user/"
)

func init() {
	http.HandleFunc(feedPrefix, serveFeed)
	http.HandleFunc("/debug", debug)
}

type User struct {
	Login string `datastore:",noindex"`
	ObfuscatedPassword []byte `datastore:",noindex"`
}

func userKey(context appengine.Context, login string) *datastore.Key {
	return datastore.NewKey(context, "User", login, 0, nil)
}

func serveFeed(w http.ResponseWriter, r *http.Request) {
	// 1. Lookup user.
        // 2. Fetch checklist data.
	//   2.1. If not refreshed recently, download checklist ids.
	//   2.2. Look up missing checklists.
	// 3. Transform checklists into RSS/Atom elements.

	login, err := parseUser(r.URL.Path)
	if (err != nil) {
		http.NotFound(w, r)
		return
	}

	context := appengine.NewContext(r)

	user := new(User)
	err = datastore.Get(context, userKey(context, login), user)
	if err != nil {
		log(w, err)
		return
	}

	log(w, user.Login)

	client := ebird.NewClient(context)

	form := url.Values{}
	form.Set("j_username", user.Login)
	form.Set("j_password", user.Password)
	form.Set("cmd", "login")
	resp, err := client.PostForm("https://ebird.org/ebird/j_acegi_security_check", form)
	if (err != nil) {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
{'fraction_non_alphanumeric': 0.15919452887537994, 'fraction_numerical': 0.003419452887537994, 'mean_word_length': 4.2345924453280315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2697292', 'n_tokens_mistral': 1032, 'n_tokens_neox': 998, 'n_words': 221}