def __init__(self): super().__init__() config = mindsapi.MindsAPI.get_config() self.api = mindsapi.MindsAPI( config['minds']['user'], config['minds']['password']) self.api.login() self.title = 'Post to Minds' self.setWindowTitle(self.title) self.textbox = QPlainTextEdit(self) self.shortcut = QShortcut(QKeySequence("Ctrl+Return"), self) self.shortcut.activated.connect(self.on_click) grid = QGridLayout() grid.setSpacing(0) grid.addWidget(self.textbox) self.setLayout(grid) self.setGeometry(100, 100, 300, 200) self.show()
#!/usr/bin/env python3 import os import sys from mindsapi import mindsapi from datetime import * import plotly.plotly as py import plotly.graph_objs as go from plotly import offline api = mindsapi.MindsAPI(os.environ['MINDS_USER'], os.environ['MINDS_PW']) api.login() id = '874947004973719557' id = '708987537296728073' posts = api.get_personal_feed(id, limit=100) table = '{:<20}, {:<20}, {:>10}' data = [] for p in posts: created = str(datetime.fromtimestamp(int(p['time_created']))) print(table.format(created, p['guid'], p['impressions'])) data.append((created, p['impressions'])) data = [go.Scatter(x=[d[0] for d in data], y=[d[1] for d in data])] fig = go.Figure(data=data) offline.plot(fig, filename="minds.html")
#!/usr/bin/env python3 from mindsapi import mindsapi import os import json import sys def read_stdin(): return '\n'.join(sys.stdin.readlines()) username = os.environ['MINDS_USER'] password = os.environ['MINDS_PW'] api = mindsapi.MindsAPI(username, password) api.login() body = read_stdin() id = sys.argv[1] r = api.update_blog(id, body) print(json.dumps(r.json(), indent=4))
if IMG_URL == None: images = [f for f in listdir(BACKGROUNDS) if isfile(join(BACKGROUNDS, f))] file = BACKGROUNDS + '/' + random.choice(images) else: file = "img.jpg" download_image(IMG_URL, file) fonts = [f for f in listdir(FONTS) if isfile(join(FONTS, f))] font = FONTS + '/' + random.choice(fonts) print(file) print(font) render_text(file, text, out, font) cfg = mindsapi.MindsAPI.get_config() api = mindsapi.MindsAPI(cfg['minds']['user'], cfg['minds']['password']) api.login() api.post_image('', out) api = gabapi.GabAPI(cfg['gab']['user'], cfg['gab']['password']) api.login() api.post_comment('', out) api = gnusocialapi.GnuSocialAPI(cfg['gnu_social']['user'], cfg['gnu_social']['password']) api.post_image(out) os.remove(out)
#!/bin/env python3 import json import sys from datetime import datetime from mindsapi import mindsapi # USAGE: # post_image.py [USERNAME] [PASSWORD] [PATH TO IMAGE] api = mindsapi.MindsAPI(sys.argv[1], sys.argv[2]) api.login() api.post_custom(sys.argv[3], ' ', ' ', ' ', sys.argv[3])
commands = { # Keep default in the first spot, as the help output will skip it. 'default': fortune, 'calc': calc, 'formula': formula, 'fortune': fortune, 'gif': get_gif, 'help': help, 'image': get_image, 'meme': meme, 'soundcloud': soundcloud } print('Logging into Minds ...') api = mindsapi.MindsAPI(USER_NAME, PASSWORD) api.login() seen = load_state(STATE_FILE) print('Loaded save state:', len(seen)) print('Starting to poll for tags ...') while True: try: for tag in api.get_tags(10): if tag['guid'] in seen: continue print('Found a new tag.') try: cmd = parse_notification(tag) print('Command received:', cmd)