-
Notifications
You must be signed in to change notification settings - Fork 84
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
Follower url works in browser, does not in twtxt #102
Comments
The url above gives 301 and redirects to http://mdom.github.io/twtxt.txt, which works. |
The HTTPS URL doesn't work because of an invalid SSL certificate. This is intended behaviour. |
Is there a need to support something like Personally, I would leave it as it is - that's what certificates are for! However, maybe someone has a very good reason?! Otherwise I suggest to close this issue. |
We could catch the exception and print a user friendly error message, but I’m definitely not a fan of skipping the certificate check. |
I'm not asking for skipping the checks, a descrtiptive error message is fine, in both cases. |
Okay. Will work on this. |
From the understanding I got out of reading the source code, I coded a 'hack' on
import asyncio
import logging
import aiohttp
import ssl
import click
from twtxt.cache import Cache
from twtxt.helper import generate_user_agent
from twtxt.parser import parse_tweets
logger = logging.getLogger(__name__)
@asyncio.coroutine
def retrieve_status(client, source):
status = None
try:
response = yield from client.head(source.url)
status = response.status
yield from response.release()
except ssl.CertificateError:
click.echo(("✗ {0} : the website's SSL certificate is untrusted. Try using HTTP, " +
"or contact the site's administrator to report the issue").format(click.style("SSL Error", bold = True, fg = "red")))
except Exception as e:
logger.debug(e)
finally:
return source, status However I have two concers over this modification :
So what do you think? (also, I just recently discovered twtxt and since it looks like a young project, if I could make my python skills useful to anyone that would be great.) EDIT: This piece of code should handle 5 of the basic HTTP redirection codes (301, 302, 303, 307, 308), which seems to be one of the issues here : Lymkwi@bf91cfc . |
Thanks for your input! I added the warning to And instead of |
HTTP:
HTTPS
works in the browser.
The text was updated successfully, but these errors were encountered: