Exemplo n.º 1
0
def main():
    browser = utility.login("USER", "PASS")
    month = utility.get_month_text()
    year = utility.get_year()
    title = "Escritorios de {} de {}".format(month, year)
    message = "Ya sabéis de qué va el tema. Si vais a poner una sola imagen, ponedla directamente :D"
    utility.new_thread(message, title, 13, 6, browser)
Exemplo n.º 2
0
def main():
    browser = utility.login("USER", "PASS")
    threads = utility.threads("threads")
    for thread in threads:
        message = utility.get_porn(thread[0])
        utility.post(message, thread[1], browser)
        time.sleep(60)
Exemplo n.º 3
0
def main():
    browser = utility.login("user", "password")
    data = utility.get_apod()
    title = data['title']
    explanation = data['explanation']
    type = data['media_type']
    message = '[b]{}[/b]\n\n{}\n\n'.format(title,explanation)
    if "image" in type:
        if data['hdurl']:
            message = message + '[img]{}[/img]'.format(data['hdurl'])
        else:
            message = message + '[img]{}[/img]'.format(data['url'])
    else:
        video = data['url'].lstrip('https://www.youtube.com/embed/')
        message = message + '[video]https://www.youtube.com/watch?v={}[/video]'.format(video)
    utility.post(message, 555411, browser)
Exemplo n.º 4
0
def main():
    """Shows basic usage of the Gmail API.
    Lists the user's Gmail labels.
    """
    creds = login()

    service = build('gmail', 'v1', credentials=creds)

    # Call the Gmail API
    results = service.users().labels().list(userId='me').execute()
    labels = results.get('labels', [])

    if not labels:
        print('No labels found.')
    else:
        print('Labels:')
        for label in labels:
            print(label['name'])
Exemplo n.º 5
0
def main():
    browser = utility.login(USERNAME_MV, PASSWORD_MV)
    data = {}
    r = requests.get("http://observatorio.info/")
    soup = BeautifulSoup(r.content, "lxml")
    title = soup.find('h1', 'intro')
    description = soup.find('div', 'lead main icn-enlarge').find('p')
    image = soup.find('div', 'col-sm-12 aq-first aq-last text-center icn-enlarge').find('a')
    video = soup.find('div', 'col-sm-12 aq-first aq-last text-center icn-enlarge').find('iframe')
    if image is not None:
        r = requests.get(image['href'])
        with open("imagen.jpg", "wb") as code:
            code.write(r.content)
        imagen = Image.open("./imagen.jpg")
        imagen.save("./imagen_comprimida.jpg", quality=90)
        im = pyimgur.Imgur(CLIENT_ID)
        uploaded_image = im.upload_image("./imagen_comprimida.jpg", title="Astronomic Picture of Day")
        data['image'] = uploaded_image.link
    if video is not None:
        data['video'] = video['src']
    data['title'] = title.text
    data['description'] = description.text

    title = data['title']
    explanation = data['description']
    message = '[b]{}[/b]\n\n{}\n\n'.format(title, explanation)
    if 'image' in data:
        message += '[img]{}[/img]\n\n{}'.format(data['image'], image['href'])
    else:
        if 'youtube' in data['video']:
            video = data['video'].lstrip('https://www.youtube.com/embed/')
            message += '[video]https://www.youtube.com/watch?v={}[/video]'.format(video)
        else:
            message = message + "\nDebido a capacidades del foro de mediavida, me es imposible insertar el siguiente enlace. Haz clic si deseas ver el contenido: " + \
                      data['video']
    utility.post(message, 555411, browser)  # post de ciencia
Exemplo n.º 6
0
def main(username, password):
    login_data = utility.login(username, password)
    header_all = utility.get_headers(login_data)
    student_data = get_students(header_all)
    return get_students_detail(student_data)
Exemplo n.º 7
0
"""
main.py is the main script for running and interacting with the ETS twitter.
"""

import utility

tweets = utility.get_tweets(utility.login(), num=100)
print "NEW TWEETS\n\n\n"
print "MARKOV"
utility.write_file(tweets)
Exemplo n.º 8
0
import student
import utility
import json
from random import randint

username = '******'
password = '******'
user_url = utility.base_url + '/api/v1/user'
login_data = utility.login(username, password)
header_all = utility.get_headers(login_data)
student_data = student.get_students(header_all)


def get_username(student):
    username = student['person']['first_name'].lower(
    ) + '_' + student['person']['last_name'].lower() + '_' + str(randint(
        1, 99))
    user_of_id = utility.requests.get(user_url + '/?username='******'meta']['total_count'] > 0)
    if (user_of_id['meta']['total_count'] > 0):
        get_username(student)
    return username


for istudent in student_data:
    username = get_username(student=istudent)
    header_all['Content-Type'] = 'application/json'
    data = {
        "person": {