教務システムにログインしてAPIの内容を出力#45
Draft
Hosoda-abo wants to merge 4 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
教務システムにログインしてセッションを維持し、その後に指定APIを呼び出してレスポンス内容を標準出力へ出すためのCloud Run Job相当の cmd エントリポイントを追加するPRです。
Changes:
- 教務システムのログインフォーム(hidden field含む)を取得してPOSTするログイン処理を追加
- セッション維持した
http.ClientでAPIをGETし、レスポンスを出力する処理を追加
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+53
to
+64
| // --- 2. フォームのpayloadを組み立てる --- | ||
| payload := url.Values{} | ||
| payload.Set("__LASTFOCUS", "") | ||
| payload.Set("__EVENTTARGET", "") | ||
| payload.Set("__EVENTARGUMENT", "") | ||
| payload.Set("__SCROLLPOSITIONX", "0") | ||
| payload.Set("__SCROLLPOSITIONY", "0") | ||
| payload.Set("ctl00$MainContent$TargetYearList", targetYear) | ||
| payload.Set("ctl00$MainContent$TargetTermList", targetTerm) | ||
| payload.Set("ctl00$MainContent$LoginId", username) | ||
| payload.Set("ctl00$MainContent$LoginPassword", password) | ||
| payload.Set("ctl00$MainContent$LoginButton", "ログイン") |
Comment on lines
+100
to
+116
| resp, err := client.Get(apiURL) | ||
| if err != nil { | ||
| return fmt.Errorf("API取得失敗: %w", err) | ||
| } | ||
| defer resp.Body.Close() | ||
|
|
||
| fmt.Println("ステータスコード:", resp.StatusCode) | ||
| fmt.Println("Content-Type:", resp.Header.Get("Content-Type")) | ||
|
|
||
| body, err := io.ReadAll(resp.Body) | ||
| if err != nil { | ||
| return fmt.Errorf("読み込み失敗: %w", err) | ||
| } | ||
|
|
||
| fmt.Println("---レスポンス内容---") | ||
| fmt.Println(string(body)) | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Deploying fun-dotto-server-docs with
|
| Latest commit: |
6d3b6c5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://393008e0.fun-dotto-server-docs.pages.dev |
| Branch Preview URL: | https://room-reservation-job.fun-dotto-server-docs.pages.dev |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更点
課題