bootcamp
bootcamp copied to clipboard
Getting error when a comment has a link
HTTPError: 400 Client Error: Bad Request for url: https://twitter.com/hashtag/genuary?src=hashtag_click
(10 additional frame(s) were not displayed)
...
File "django/db/models/query.py", line 433, in create
obj.save(force_insert=True, using=self.db)
File "bootcamp/news/models.py", line 52, in save
data = fetch_metadata(self.content)
File "bootcamp/helpers.py", line 100, in fetch_metadata
return get_metadata(urls[0])
File "bootcamp/helpers.py", line 138, in get_metadata
response.raise_for_status()
File "requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
More information about this issue here: https://github.com/EncontrosDigitais/bootcamp/issues/26
This is error is very consistent with twitter links. Can anyone please help?
@Vamoss do you have an example of the original text causing this error? If this is happening with the comments, have you tried changing the comments app version?
Hi @sebastian-code, I did some tests here and figure out that it is not only in the comments, it happens also on the news main publishing system.
Here is an example of a Twitter link that breaks the system because it does not have
andAnd here is another example that breaks the system because some sites require the request have a header with user-agent and content-type: https://www.alexandrerangel.art.br/curso-criatividade-audiovisual.html
The previous pull request fix both cases.