Last active
May 22, 2020 01:15
-
-
Save ksaver/36c1d00d116cf19c6cd86333f3f870d2 to your computer and use it in GitHub Desktop.
Get a random command line tip from commandlinefu.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# clify.py | |
# get a random command line tip from commandlinefu.com | |
# usage: | |
# chmod +x clifu.py | |
# ./clifu.py | |
# python 2 or 3 | |
import requests | |
try: | |
from urllib.request import Request, urlopen | |
except: | |
from urllib2 import Request, urlopen | |
clifu_url = "http://www.commandlinefu.com/commands/random/plaintext" | |
q = requests.get(clifu_url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0'}) | |
print(q.text) | |
print("url:", q.url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment