Closed picoding closed 8 years ago
Thanks, in def __init__
, today the code is as follows:
o = urlparse.urlparse(url)
if o.query != '':
self.url += '?' + o.query
if o.username is not None:
self.http_username = o.username
if o.password is not None:
self.http_password = o.password
if self.http_username != '' or self.http_password != '':
uri = (o.netloc.split('@'))[1]
else:
uri = o.netloc
self.url = o.scheme + "://" + uri + o.path
which line exactly you modified? What is letter u'?'
mean?
See https://github.com/brcontainer/html2canvas-python-proxy/blob/master/html2canvasproxy.py#L63
Hi,
I don't know if code from L65-66 is responsible only for query part of URL, if yes then you can replace it with (if not you can add below code just after L66)
if o.query != '':
self.query_part = '?' + o.query
And add following line:
query_part = ''
Then L79 should be replaced with
self.url = o.scheme + "://" + uri + o.path + self.query_part
I've not tested code intensively, but in my case mentioned modifications solved problem. Same with the flask example/test from repo.
u'' - old habbit to indicate unicode string in python 2.* :).
Cheers, TSz
@picoding Sorry for the delay
See update: https://github.com/brcontainer/html2canvas-python-proxy/commit/3e656cc3c131db41f6f628cb508e610d0de2af59
Following url is not handled properly:
127.0.0.1 - - [24/Feb/2015 12:53:44] "GET /test/html2canvas-proxy?url=https%3A%2F%2Fmts0.googleapis.com%2Fvt%3Fpb%3D!1m4!1m3!1i3!2i2!3i3!2m3!1e0!2sm!3i293000000!3m14!2sen-GB!3sUS!5e18!12m1!1e47!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!2zcy50OjN8cy5lOmx8cC52OnNpbXBsaWZpZWQ!4e0&callback=html2canvas_8 HTTP/1.1" 200 -
I solved it by changing in def init(self, callback, url):
self.url = o.scheme + "://" + uri + o.path + u'?' + o.query
Probably following code should be replaced
if o.query != '': self.url += u'?' + o.query
with something like this:
query_string = u''
[...]
if o.query != '': self.query_string = u'?' + o.query
[...]
self.url = o.scheme + "://" + uri + o.path + self.query_string