<commit_before>package main

import (
	"fmt"
	"net/http"

	"github.com/codegangsta/negroni"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Println(r.Form)

		if r.Method == "GET" {
			http.ServeFile(w, r, "./static/index.html")
		} else {
			r.ParseForm()
			fmt.Println("tag:", r.Form["tag"])
			http.ServeFile(w, r, "./static/index.html")
			//resp, err = http.Get("http://api.popshops.com/v3/products.json?account=ao7k0w59fbqag2stztxwdrod6&catalog=db46yl7pq0tgy9iumgj88bfj7&keyword=" + r.FormValue("tag"))

		}

	})

	n := negroni.Classic()
	n.UseHandler(mux)
	n.Run(":3000")
}

type RakutenProduct struct {
	Filters struct {
		Filter []interface{} `json:"filter"`
	} `json:"filters"`
	Message    string `json:"message"`
	Parameters []struct {
		Kind  string `json:"kind"`<commit_msg>read and unmarshal data into struct for rakuten stuff<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"

	"github.com/codegangsta/negroni"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Println(r.Form)

		if r.Method == "GET" {
			http.ServeFile(w, r, "./static/index.html")
		} else {
			r.ParseForm()
			fmt.Println("tag:", r.Form["tag"])
			http.ServeFile(w, r, "./static/index.html")
			resp, err := http.Get("http://api.popshops.com/v3/products.json?account=ao7k0w59fbqag2stztxwdrod6&catalog=db46yl7pq0tgy9iumgj88bfj7&keyword=" + r.FormValue("tag"))

			var rakuten RakutenProduct
			body, err := ioutil.ReadAll(resp.Body)
			err = json.Unmarshal(body, &rakuten)
			if err != nil {
				log.Fatal(err)
			}
			fmt.Println(rakuten.Status)

		}

	})

	n := negroni.Classic()
	n.UseHandler(mux)
	n.Run(":3000")
}

type RakutenProduct struct {
	Filters struct {
		Filter []interface{} `json:"filter"`
	} `json:"filters"`
	Message    string `json:"message"`
	Parameters []struct {
		Kind  string `json:"kind"`
{'fraction_non_alphanumeric': 0.1793835270338555, 'fraction_numerical': 0.019201616978271854, 'mean_word_length': 4.089974293059126, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4051767', 'n_tokens_mistral': 864, 'n_tokens_neox': 792, 'n_words': 132}