Пример #1
0
import imgur
from viewer.models import Face, SourceLog

username = ""
password = ""

access = imgur.api(username=username, password=password, secure=True)

for face in Face.objects.all():
    name = face.image.name.lstrip("f/img/").rpartition(".")[0]
    if len(name) != 5:
        continue
    print name
    img = access.image(name)
    if img:
        face.source = img["links"]["imgur_page"]
        face.save()
        SourceLog.new(face)

Пример #2
0
import shutil
import json
from PIL import Image
import requests
import base64
from cStringIO import StringIO
import imgur
import re
# "Suspension not allowed here" workaround
from PIL import ImageFile
ImageFile.MAXBLOCK = 1024*1024 # default is 64k

username = ""
password = ""
imgur_login = {"username":"", "password":"", "secure":False}
imgur_access = imgur.api(**imgur_login)

s = {"mlfw":{"session":requests.session(), "server":"https://mylittlefacewhen.com/api"},
     "dev":{"session":requests.session(), "server":"http://0.0.0.0:8000/api"}}

source_dir="/home/inopia/upload/"
failed_dir="/home/inopia/failed/"

imagedir = "/tmp/media/img/"
thumbdir = "/tmp/media/thumb/"
nqdir = "/tmp/media/pngnq/"
outdir = "/tmp/media/pngout/"
rszdir = "/tmp/media/rsz/"

ponibooru = "http://ponibooru.413chan.net/post/view/"