Sinisterly
Pomf.cat Uploader - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Pomf.cat Uploader (/Thread-Pomf-cat-Uploader)



Pomf.cat Uploader - Inori - 01-03-2016

I've started to familiarize myself with parts of requests other than just .get() recently. Last night was my first venture into the post method, which is easy as hell to use, as always.
Anyway, a cup of coffee and 20 minutes of screwing with an API later, I made this. There's two versions; one runs as a normal python file, asks for input, etc... The other is one I custom built for my context menu tutorial (link). Enjoy!

Version 1:
Code:
from requests import post r=post( url='https://pomf.cat/upload.php', files={'files[]':open(raw_input('File to upload: '),'rb')} ).text for x in eval(r[0]+r[16:])['files']: print 'https://a.pomf.cat/'+x['url']

Version 2:
Code:
from pyperclip import copy from requests import post from sys import argv r=post( url='https://pomf.cat/upload.php', files={'files[]':open(argv[1],'rb')} ).text for x in eval(r[0]+r[16:])['files']: copy('https://a.pomf.cat/'+x['url'])