GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - brcontainer/html2canvas-python-proxy: Python Proxy for html2canvas work with Django, Flask and CGI

BranchesTags
Open more actions menu

Latest commit

 

History

44 Commits
44 Commits

Folders and files

NameName
Last commit message
Last commit date
flask
flask
 
 
python-cgi
python-cgi
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
html2canvasproxy.py
html2canvasproxy.py
 
 

Repository files navigation

html2canvas-python-proxy 0.1.0

Python Proxy for html2canvas (tested in Python 2.7.3)

Although I have just added an example with "Flask" is library works with any "Python Web framework." Soon I'll add examples with other frameworks.

Others scripting language

You do not use PHP, but need html2canvas working with proxy, see other proxies:

  • html2canvas proxy in php
  • html2canvas proxy in asp.net (csharp)
  • html2canvas proxy in asp classic (vbscript)

Provisional documentation:

Module Description
html2canvasproxy([callback get param], [url get param]) Config html2canvasproxy
html2canvasproxy.enable_crossdomain() Enable the use of "Data URI scheme"
html2canvasproxy.useragent([user agent]) Config webbrowser user-agent
html2canvasproxy.hostname([url]) Config current URL (requires scheme and port)
html2canvasproxy.referer([referer]) Config referer page (If needed)
html2canvasproxy.route([real path], [virtual path]) Config "route" for images and real path (folder to save images). Note: "real path" is absolute path eg. /home/user/project1/images, "virtual path" should be as you want it to appear in the "address bar", eg. /images
html2canvasproxy.debug_vars() Get variables values for DEBUG
html2canvasproxy.result() Run proxy/Get response and mime-type by proxy.
html2canvasproxy.resource([real path], [image]) Get resource saved and mime-type by proxy "real path" is same in html2canvas.route([real path], [virtual path]). Read Get resources with proxy

How to use

A simple example of usage

from html2canvasproxy import * #Load html2canvasproxy

#Set GET variables
h2c = html2canvasproxy(request.args.get("callback"), request.args.get("url"))

#Uncomment next line to enable "data URI scheme" (optional)
#h2c.enable_crossDomain()

#Set user-aget browser
if request.headers['user_agent']:
    h2c.useragent(request.headers['user_agent'])
else:
    h2c.useragent('Mozilla/5.0')

#Set current page
h2c.hostname(request.url)

#Set referer (If needed)
if request.referer:
    h2c.referer(request.referer)

#Set route (real path and virtual path)
h2c.route('/home/guilherme/projects/site/images', '/images')

#Results
print 'Debug:'
print h2c.debug_vars()
print '---------'

result = h2c.result()

print 'mime: ' + result['mime']
print 'data: ' + result['data']
print '=========\n'

Get results with proxy

Run proxy/Get response and mime-type by proxy (returns application/javascript)

r = h2c.result()

print r['mime']
print r['data']

Get resources with proxy

Get resource saved and mime-type by proxy (returns images or html)

res = html2canvasproxy.resource(real_path, image)

print res['mime']
print res['data']

About

Python Proxy for html2canvas work with Django, Flask and CGI

Topics

html2canvashtml2canvas-proxypython

Resources

Readme
MIT license
Activity

Stars

7 stars

Watchers

3 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.