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 | |
## Tiny Syslog Server in Python3. | |
## | |
## This is a tiny syslog server that is able to receive UDP based syslog | |
## entries on a specified port and save them to a file. | |
## That's it... it does nothing else... | |
## There are a few configuration parameters. | |
LOG_FILE = 'youlogfile.log' |
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
import os | |
import urllib2, posixpath, urlparse | |
DOWNLOADS_DIR = './mp3' | |
# For every line in the file | |
for url in open('list.urls'): | |
resp = urllib2.urlopen(url) | |
# Split on the rightmost / and take everything on the right side of that | |
name = urllib2.unquote(posixpath.basename(urlparse.urlsplit(resp.url).path)) |