In [ ]:
from ftplib import FTP
import os
In [ ]:
def upload(ftp, file):
ext = os.path.splitext(file)[1]
if ext in (".txt", ".htm", ".html"):
ftp.storlines("STOR " + file, open(file))
else:
ftp.storbinary("STOR " + file, open(file, "rb"), 1024)
In [ ]:
ftp = FTP('ftp.freshfigure.com')
In [ ]:
ftp.login('ipython', 'PassWord123!')
In [ ]:
upload(ftp, '33561.jpg')
In [ ]:
data = []
In [ ]:
ftp.dir(data.append)
In [ ]:
ftp.quit()
In [ ]:
for line in data:
print '-', line
In [ ]:
from wand.image import Image
In [ ]:
from bs4 import BeautifulSoup4
In [ ]:
from __future__ import print_function
from urllib2 import urlopen
from wand.image import Image
response = urlopen('http://artcontrol.me/wp-content/uploads/2013/11/wpid-Sketch1521630.png')
try:
with Image(file=response) as img:
print('format =', img.format)
print('size =', img.rotate(90))
finally:
response.close()
In [ ]:
import gzip
from wand.image import Image
In [ ]:
gz = gzip.open('hello.png.gz')
with Image(filename='hello.png') as img:
img.format = 'jpeg'
img.save(file=gz)
gz.close()
In [ ]:
import requests
import json
In [ ]:
openWire = open('wirePIL.ipynb')
wireInfo = openWire.read()
In [ ]:
saveWire = json.loads(wireInfo)
In [ ]:
print(saveWire)
saveWire
In [ ]:
for wire in openWire():
print wire()
In [ ]:
print(wireInfo)
In [ ]:
wireFormat = wireInfo.format
In [ ]:
wireFormat()