MCPcopy Index your code
hub / github.com/google/go-github / get

Method get

scrape/scrape.go:95–117  ·  view source on GitHub ↗

get fetches a urlStr (a GitHub URL relative to the client's baseURL), and returns the parsed response document.

(urlStr string, a ...any)

Source from the content-addressed store, hash-verified

93// get fetches a urlStr (a GitHub URL relative to the client's baseURL), and
94// returns the parsed response document.
95func (c *Client) get(urlStr string, a ...any) (*goquery.Document, error) {
96 u, err := c.baseURL.Parse(fmt.Sprintf(urlStr, a...))
97 if err != nil {
98 return nil, fmt.Errorf("error parsing URL: %q: %v", urlStr, err)
99 }
100
101 resp, err := c.Client.Get(u.String())
102 if err != nil {
103 return nil, fmt.Errorf("error fetching url %q: %v", u, err)
104 }
105 defer resp.Body.Close()
106
107 if resp.StatusCode == http.StatusNotFound {
108 return nil, fmt.Errorf("received %v response fetching URL %q", resp.StatusCode, u)
109 }
110
111 doc, err := goquery.NewDocumentFromReader(resp.Body)
112 if err != nil {
113 return nil, fmt.Errorf("error parsing response: %v", err)
114 }
115
116 return doc, nil
117}
118
119// Authenticate client to GitHub with the provided username, password, and if
120// two-factor auth is enabled for the account, otpseed.

Callers 3

OrgPaymentInformationMethod · 0.95
ListOAuthAppsMethod · 0.95

Calls 3

CloseMethod · 0.80
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected