コード例 #1
0
ファイル: google_form.py プロジェクト: cyrusn/track_timer
    def submit(self, school_code, team, track, time):
        school_name = School.getName(school_code)

        form_data = {
            "entry.1154166350": school_name,
            "entry.102136851": team,
            "entry.1499830162": track,
            "entry.2008640348": time,
        }

        data = urlencode(form_data).encode("ascii")
        try:
            with urlopen(self.URL, data) as f:
                if f.getcode() == 200:
                    print(
                        format_string("Submitted", track, school_name, team,
                                      time))
                else:
                    print("ERROR: {}\n{}".format(f.getcode(), f.info()))
        except HTTPError as e:
            print(e.code)
            print(e.read())
コード例 #2
0
 def school_name(self):
     return School.getName(self.school_code)