http error 406 not acceptable

HTTP Error 406 Not Acceptable occurs when a web server cannot deliver a response in a format that the browser or client can accept. This usually happens due to incorrect request headers, server security rules, or restrictive settings in the website configuration.

To fix it, try clearing your browser cache, checking the URL, or refreshing the page. For website owners, the issue can be resolved by reviewing server settings, adjusting content-type configurations, disabling conflicting plugins, or modifying security rules in the server or firewall that may be blocking the request.
 
HTTP Error 406 Not Acceptable occurs when a web server cannot deliver a response in a format that the browser or client can accept. This usually happens due to incorrect request headers, server security rules, or restrictive settings in the website configuration.

To fix it, try clearing your browser cache, checking the URL, or refreshing the page. For website owners, the issue can be resolved by reviewing server settings, adjusting content-type configurations, disabling conflicting plugins, or modifying security rules in the server or firewall that may be blocking the request.

hey maria, op is using python for this, not a regular browser so clearing cache probably won't do anything. for python, you gotta send some headers. most times for rss you want to set an 'Accept' header to like 'application/xml' or 'text/xml'. sometimes a 'User-Agent' helps too, make it look like a regular browser. you pass that as a dict to the requests library.
 
A 406 usually means the server doesn’t like your request headers (often User-Agent or Accept). The simplest fix is to make your request look like a normal browser. In Python, you can pass headers with something like requests.get(url, headers={"User-Agent": "Mozilla/5.0", "Accept": "application/rss+xml, application/xml;q=0.9,*/*;q=0.8"}). I’ve run into this with a few feeds—just setting a realistic User-Agent and a broad Accept header usually gets past it; if not, add Accept-Language and Connection: keep-alive too.
 
An HTTP 406 Not Acceptable error occurs when a server cannot generate a response matching the client’s “Accept” headers, such as requested content type or language. It often arises from misconfigured servers, incorrect MIME types, or restrictive headers. Fixes include adjusting headers, server settings, or requested formats to ensure compatibility.
 
fetching an rss feed with python and the server is returning a 406. how do i spoof my headers so it accepts the request?

Hey, jumping into this thread! Tonnyjaction, imo, besides just the User-Agent, the Accept header is super critical for RSS feeds and often causes 406s. You might need to experiment with `Accept: application/rss+xml`, `text/xml`, or even `*/*`. Some servers are really strict. Also, if the server thinks you're a bot, adding a `Referer` header can sometimes trick it. It's basically trial and error sometimes until you find what makes that specific server happy. Hope you get it working!
 
Back
Top