Created
June 22, 2012 09:54
-
-
Save DamianZaremba/2971763 to your computer and use it in GitHub Desktop.
Horrid depython.com client
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 python | |
import os | |
import sys | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
try: | |
file_path = sys.argv[1] | |
except: | |
print "Usage: %s <file path>" % sys.argv[0] | |
sys.exit() | |
if not os.path.isfile(file_path): | |
print "Specified file isn't a file!" | |
sys.exit() | |
fh = open(file_path) | |
request = requests.post( | |
url='http://www.depython.com/index.php', | |
files = {'userfile': fh} | |
) | |
soup = BeautifulSoup(request.text) | |
ta = soup.findAll('textarea')[0] | |
lines = ta.contents[0].split("\n") | |
print "\n".join(lines[:-3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment