google-gemini / cookbook

Examples and guides for using the Gemini API
https://ai.google.dev/gemini-api/docs
Apache License 2.0
5.48k stars 845 forks source link

Downloading scikit-learn news dataset gives HTTPError: HTTP Error 403: Forbidden #142

Closed cast42 closed 6 months ago

cast42 commented 6 months ago

Description of the bug:

newsgroups_train = fetch_20newsgroups(subset='train')
newsgroups_test = fetch_20newsgroups(subset='test')

# View list of class names for dataset
newsgroups_train.target_names

gives following error:

HTTPError                                 Traceback (most recent call last)
[<ipython-input-3-f3476b42207e>](https://localhost:8080/#) in <cell line: 1>()
----> 1 newsgroups_train = fetch_20newsgroups(subset='train')
      2 newsgroups_test = fetch_20newsgroups(subset='test')
      3 
      4 # View list of class names for dataset
      5 newsgroups_train.target_names

9 frames
[/usr/lib/python3.10/urllib/request.py](https://localhost:8080/#) in http_error_default(self, req, fp, code, msg, hdrs)
    641 class HTTPDefaultErrorHandler(BaseHandler):
    642     def http_error_default(self, req, fp, code, msg, hdrs):
--> 643         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    644 
    645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: Forbidden

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

cast42 commented 6 months ago

This issue has been resolved Screenshot 2024-05-18 at 11 50 56

Skyisclear commented 5 months ago

the code still gives me the same error. it was done in google colab.

` HTTPError Traceback (most recent call last) in <cell line: 4>() 2 3 # news_data = fetch_20newsgroups(subset='all',random_state=156) ----> 4 newsgroup_train = fetch_20newsgroups(subset='train') 5 newsgroup_test = fetch_20newsgroups(subset='test')

9 frames /usr/lib/python3.10/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs) 641 class HTTPDefaultErrorHandler(BaseHandler): 642 def http_error_default(self, req, fp, code, msg, hdrs): --> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp) 644 645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: Forbidden `

ssangttuce commented 5 months ago

I have same error.

HTTPError Traceback (most recent call last) in <cell line: 4>() 2 categories = ["alt.atheism", "talk.religion.misc", "comp.graphics", "sci.space"] 3 # train set을 가져옴 ----> 4 newsgroups_train = fetch_20newsgroups( 5 data_home=".20newsgroups", 6 subset="train",

9 frames /usr/lib/python3.10/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs) 641 class HTTPDefaultErrorHandler(BaseHandler): 642 def http_error_default(self, req, fp, code, msg, hdrs): --> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp) 644 645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: Forbidden

I think this error occurs randomly...

corngk commented 5 months ago

I also got the same 403 Forbidden error in Google Colab.

WillMusing commented 5 months ago

same error when running from colab:

11 frames /usr/lib/python3.10/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs) 641 class HTTPDefaultErrorHandler(BaseHandler): 642 def http_error_default(self, req, fp, code, msg, hdrs): --> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp) 644 645 class HTTPRedirectHandler(BaseHandler):