Danbooru

Got 403 forbidden when I do anything

Posted under Bugs & Features

Talulah said:

Probably a Cloudflare block. Make sure you're sending a valid User-Agent header.

Thanks for the quick reply. I've never done that before, could you point me to some resource where I can educate myself?

  • Reply
  • Talulah said:

    Here's an MDN article on it. How you actually add it will depend based on the HTTP library in use.

    If you are using Python with the python-requests library (since it's popular) it will look like this:

    import requests
    
    headers = { "User-Agent": "nsfwjjjjjBot/1.0.0" }
    
    requests.get(some_url, headers=headers)

    Thanks, added a custom User-Agent string and it works again now!

  • Reply
  • 1