Exemplo n.º 1
0
def add_api_key(url):
    """
    Adds your API key to the end of the URL.
    """
    key = fs.read_first_line(WORDNIK)
    sep = '&' if '?' in url else '?'
    return '{url}{sep}api_key={key}'.format(url=url, sep=sep, key=key)
Exemplo n.º 2
0
def add_api_key(url):
    """
    Adds your API key to the end of the URL.
    """
    key = fs.read_first_line(WORDNIK)
    sep = '&' if '?' in url else '?'
    return '{url}{sep}api_key={key}'.format(url=url, sep=sep, key=key)
Exemplo n.º 3
0
def test_save_readme():
    assert img.make_dirs()
    #
    text = """readme 1st line
readme 2nd line"""
    img.readme = text
    assert not os.path.exists(img.get_readme_path())
    img.save_readme()
    line = fs.read_first_line(img.get_readme_path())
    assert line == 'readme 1st line'
    os.unlink(img.get_readme_path())
    assert not os.path.exists(img.get_readme_path())
Exemplo n.º 4
0
def test_save_readme():
    assert img.make_dirs()
    #
    text = """readme 1st line
readme 2nd line"""
    img.readme = text
    assert not os.path.exists(img.get_readme_path())
    img.save_readme()
    line = fs.read_first_line(img.get_readme_path())
    assert line == 'readme 1st line'
    os.unlink(img.get_readme_path())
    assert not os.path.exists(img.get_readme_path())
Exemplo n.º 5
0
        self.name = 'HyperBot'
        
Now you are ready to flood reddit :)

# from jabbapylib.reddit import red
"""

import sys
import reddit
from jabbapylib.filesystem import fs
from jabbapylib.podium import podium

USERNAME_TXT = '{home}/reddit_username.txt'.format(home=podium.get_home_dir())
PASSWORD_TXT = '{home}/reddit_password.txt'.format(home=podium.get_home_dir())
#
USERNAME = fs.read_first_line(USERNAME_TXT)
PASSWORD = fs.read_first_line(PASSWORD_TXT)


class RedBot(object):
    def __init__(self):
        self.name = 'RedBot'
        self.username = USERNAME
        self.password = PASSWORD
        #
        self.r = reddit.Reddit(user_agent=self.name)
        self.r.login(username=self.username, password=self.password)
        self.last_post = None   # Submission object
        self.permalink = None   # URL of the last post
        
    def submit_link(self, url, subreddit, title):
#!/usr/bin/env python

"""
splinter

http://splinter.cobrateam.info
"""

from splinter.browser import Browser
from jabbapylib.filesystem import fs

PE_LOGIN = '******'
PE_COUNTRIES = 'http://projecteuler.net/countries'

USERNAME = fs.read_first_line('/home/jabba/secret/project_euler/username.txt')
PASSWORD = fs.read_first_line('/home/jabba/secret/project_euler/password.txt')

def main():
#    browser = Browser('chrome')
    browser = Browser()
    browser.visit(PE_LOGIN)
    
    browser.fill('username', USERNAME)
    browser.fill('password', PASSWORD)
    button = browser.find_by_name('login')
    button.click()

    browser.visit(PE_COUNTRIES)
       
    f = open("/tmp/stat.html", "w")
    print >>f, browser.html
Exemplo n.º 7
0
 def test_read_first_line(self):
     res = fs.read_first_line(FILE)
     assert res == 'first line'
Exemplo n.º 8
0
        self.name = 'HyperBot'

Now you are ready to flood reddit :)

# from jabbapylib.reddit import red
"""

import sys
import reddit
from jabbapylib.filesystem import fs
from jabbapylib.podium import podium

USERNAME_TXT = '{home}/reddit_username.txt'.format(home=podium.get_home_dir())
PASSWORD_TXT = '{home}/reddit_password.txt'.format(home=podium.get_home_dir())
#
USERNAME = fs.read_first_line(USERNAME_TXT)
PASSWORD = fs.read_first_line(PASSWORD_TXT)


class RedBot(object):
    def __init__(self):
        self.name = 'RedBot'
        self.username = USERNAME
        self.password = PASSWORD
        #
        self.r = reddit.Reddit(user_agent=self.name)
        self.r.login(username=self.username, password=self.password)
        self.last_post = None  # Submission object
        self.permalink = None  # URL of the last post

    def submit_link(self, url, subreddit, title):
Exemplo n.º 9
0
#!/usr/bin/env python
"""
splinter

http://splinter.cobrateam.info
"""

from splinter.browser import Browser
from jabbapylib.filesystem import fs

PE_LOGIN = '******'
PE_COUNTRIES = 'http://projecteuler.net/countries'

USERNAME = fs.read_first_line('/home/jabba/secret/project_euler/username.txt')
PASSWORD = fs.read_first_line('/home/jabba/secret/project_euler/password.txt')


def main():
    #    browser = Browser('chrome')
    browser = Browser()
    browser.visit(PE_LOGIN)

    browser.fill('username', USERNAME)
    browser.fill('password', PASSWORD)
    button = browser.find_by_name('login')
    button.click()

    browser.visit(PE_COUNTRIES)

    f = open("/tmp/stat.html", "w")
    print >> f, browser.html
Exemplo n.º 10
0
 def test_read_first_line(self):
     res = fs.read_first_line(FILE)
     assert res == 'first line'