This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import json | |
import re | |
import time | |
import random | |
import webbrowser | |
# 补充自己的 COOKIE _xsrf 的值 | |
COOKIE = '_xsrf=XXX' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip | |
import pip | |
from subprocess import call | |
for dist in pip.get_installed_distributions(): | |
call("pip install --upgrade " + dist.project_name, shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import uuid | |
from flask import Flask, render_template, redirect, url_for, request | |
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class | |
from flask_wtf import FlaskForm | |
from flask_wtf.file import FileField, FileRequired, FileAllowed | |
from wtforms import SubmitField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- create a folder named templates, put this file into it --> | |
<!DOCTYPE html> | |
<title>Upload File</title> | |
<h1>Photo Upload</h1> | |
<form method="POST" enctype="multipart/form-data"> | |
{{ form.hidden_tag() }} | |
{{ form.photo }} | |
{% for error in form.photo.errors %} | |
<span style="color: red;">{{ error }}</span> | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
from flask import Flask, request | |
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class | |
app = Flask(__name__) | |
app.config['UPLOADED_PHOTOS_DEST'] = os.getcwd() | |
photos = UploadSet('photos', IMAGES) | |
configure_uploads(app, photos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
from flask import Flask, request, url_for, send_from_directory | |
from werkzeug import secure_filename | |
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) | |
app = Flask(__name__) | |
app.config['UPLOAD_FOLDER'] = os.getcwd() | |
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="gallery"> | |
<img src=""> | |
<img src=""> | |
<img src=""> | |
<img src=""> | |
<img src=""> | |
<img src=""> | |
... | |
</div> |