Python Forum
urllib.error.HTTPError: HTTP Error 404: Not Found
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
urllib.error.HTTPError: HTTP Error 404: Not Found
#3
Drop all other modules and use only Requests as you have in import.
Call in line 15 is wrong snippet,id&order can not have ,.
Example getting subscribers count for a YouTube channel.
import requests

api_key = 'xxxxxxxxxxxxxxxxx'
channel_id = 'UC5kS0l76kC0xOzMPtOmSFGw'
response = requests.get(f'https://www.googleapis.com/youtube/v3/channels?part=statistics&id={channel_id}&key={api_key}')
Test usage:
>>> response
<Response [200]>
>>> j = response.json()
>>> j['items'][0]['statistics']['subscriberCount']
'273000'
Possible fix for your call.
import requests

api_key = 'xxxxxxxxxxxxxxxx'
channel_id = 'UC5kS0l76kC0xOzMPtOmSFGw'
response = requests.get(f'https://www.googleapis.com/youtube/v3/channels?part=snippet&order=date&maxResults=1&id={channel_id}&key={api_key}')
json_data = response.json()
# Do call on returned json_data
Reply


Messages In This Thread
RE: urllib.error.HTTPError: HTTP Error 404: Not Found - by snippsat - Feb-13-2020, 07:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the error of not being able to pull data in this code? i didn't see an error? TestPerson 2 1,251 Sep-30-2022, 02:36 PM
Last Post: DeaD_EyE
  Getting from <td> tag by using urllib,Beautifulsoup KuroBuster 2 2,086 Aug-20-2021, 07:53 AM
Last Post: KuroBuster
  HTTP 404 error with Session Pool Clives 0 1,337 Jun-17-2021, 06:45 PM
Last Post: Clives
  error HTTP Error 403: Forbidden local_bit 1 2,875 Nov-14-2020, 11:34 AM
Last Post: ndc85430
  Beginner: urllib error tomfry 7 6,624 May-03-2020, 04:35 AM
Last Post: Larz60+
  python beginner HTTP Error 500 leofcastro 0 2,202 Jan-24-2020, 04:37 PM
Last Post: leofcastro
  HTTP error 404 Karin 4 4,765 May-31-2019, 02:23 PM
Last Post: snippsat
  How to check HTTP error 500 and bypass SriMekala 3 10,670 May-04-2019, 02:07 PM
Last Post: snippsat
  SSLCertVerificationError using urllib (urlopen) FalseFact 1 5,931 Mar-31-2019, 08:34 AM
Last Post: snippsat
  Error: module 'urllib' has no attribute 'urlopen' mitmit293 2 15,125 Jan-29-2019, 02:32 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020