-
Notifications
You must be signed in to change notification settings - Fork 22
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
Script to generate URLs for Ultracool Sheet. Closes #389 #451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use urllib
to handle strings
Thanks for the suggestion! Any thoughts on how to properly test the links? Right now, even bad links return 200 because you're doing good error handling on the website. |
Hmm, how about results: dict = db.inventory(simple_source)
assert('Sources' in results.keys()) or that sort of logic? |
Alternatively, I could edit the logic on the website to fail on a bad result and return a 404. |
Yeah, I really want to test the URL. Maybe we give a 404 error but include all that useful text on the 404 page. Is that possible? |
Okie dokie I'll see what I can do |
Returning the exact text as would appear on the 404 page on the website isn't quite as simple and not really worthwhile (would have to make custom headers etc), because of how WSGI handles things server side. It's not really the done thing to override the default status code message. |
Even though this doesn't modify the database, I think this script is worth having. I think we will end up building more scripts related to the sheet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and I see from the email thread that you got a working csv of all matches!
Here is a script to generate the SIMPLE URL for sources in the Ultracool Sheet.
This draft tries to do URL checking but unfortunately, any invalid URLs give status code 200. We need to figure out how to do proper URL checking.