Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Error 403: Forbidden #33

Open
Ironclad17 opened this issue Oct 31, 2024 · 1 comment
Open

HTTP Error 403: Forbidden #33

Ironclad17 opened this issue Oct 31, 2024 · 1 comment

Comments

@Ironclad17
Copy link

Ironclad17 commented Oct 31, 2024

Just trying to upload a text file. The url I requested didn't exist beforehand, but I received a different error than usual. I uploaded the file manually, but the raw function still generates the same error even though it does contain text now.

Traceback (most recent call last):
  File "C:\Users\*\appdata\roaming\python\python312\site-packages\rentry.py", line 41, in raw
    return json_loads(client.get('https://rentry.co/api/raw/{}'.format(url)).data)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\appdata\roaming\python\python312\site-packages\rentry.py", line 25, in get
    return self._request(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\appdata\roaming\python\python312\site-packages\rentry.py", line 33, in _request
    response = self.opener.open(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Users\*\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
@Ironclad17
Copy link
Author

Ironclad17 commented Nov 7, 2024

Even directly requesting the url still receives the same error. The other functions work though. Is this related to the fact that the raw function doesn't create a csrftoken?

>>> import requests
>>> url = '3f40ac76'
>>> requests.get('https://rentry.co/api/raw/{}'.format(url), headers={})
<Response [403]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant