Clickable hyperlinks

Deborah Swanson python at deborahswanson.net
Wed Jan 4 17:58:42 EST 2017


Chris Angelico wrote, on January 04, 2017 4:16 AM
> 
> On Wed, Jan 4, 2017 at 10:43 PM, Deborah Swanson 
> <python at deborahswanson.net> wrote:
> > I'm quite well aware by now that there is no one-sentence 
> answer to my 
> > original question, if there's any coherent answer at all. 
> Them's the 
> > breaks. Live with it or live without it, it doesn't care.
> 
> Yeah, there's no simple answer; however, you'll find that 
> Python on many platforms is entirely capable of popping a URL 
> up in the user's default browser. Check this out:
> 
> >>> import antigravity
> 
> This uses the 'webbrowser' module, which knows about a number 
> of different ways to open a browser, and will attempt them 
> all. So if you can figure out the UI part of things, actually 
> making the link pop up in a browser isn't too hard; for 
> instance, if you're doing OAuth at the command line and need 
> the user to go and authenticate, you can simply 
> webbrowser.open("http://......./") and it'll DTRT.
> 

Thank you, thank you! Finally, at least one person on this list knows
about something (anything) in the python world that is internet aware.
It's also occurred to me that Beautifulsoup downloads data from a url,
so that code must have access to some kind of an internet engine too.

I googled antigravity and found a number of interesting links. 

The History of Python: import antigravity
http://python-history.blogspot.com/2010/06/import-antigravity.html

Among other things, it was added to Python 3 in 2010, so it's been
around a little while. And a comment mentions that "The antigravity
module is also included in Python 2.7."

And a reddit poster tells us that "if you type 'import antigravity' into
a Python command line your default browser opens the XKCD comic 'Python'
in a tab."
https://www.reddit.com/r/ProgrammerHumor/comments/1hvb5n/til_if_you_type
_import_antigravity_into_a_python/

An "import antigravity" video at
https://www.youtube.com/watch?v=_V0V6Rk6Fp4

And its page in the Package Index:
https://pypi.python.org/pypi/antigravity/0.1, with a Page Not Found
Error for the Home Page. So it doesn't look like there's any alternative
but to download it and look at the code.

Yes, I'd gotten as far as figuring out that you don't need a clickable
link. Code that opens a url in a browse would do the job just fine. Or
the webbrowser.open("http://......./") in a Linux terminal you suggest.
(I just have to get my Linux machine up and running again to try it.)

All in all, given that clickable urls in a console is a non-starter,
this hits the nail on the head. Many thanks again!

Deborah


   




More information about the Python-list mailing list