simplyvikram / google-chartwrapper

Automatically exported from code.google.com/p/google-chartwrapper
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

quote_plus error #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a marker in the following format... 
@yl'h\=18'f\909000'c\l-0-13'a,,0,0:0.152,0
2. Use G.marker ("@yl\'h\\=18\'f\\a06000\'c\\l-0-13\'a", '', 0, '0:0.152', 0)
3.

What is the expected output? What do you see instead?
Expected:@yl'h\=18'f\909000'c\l-0-13'a,,0,0:0.152,0
Instead: %40yl%27h%5C=18%27f%5C909000%27c%5Cl-0-13%27a,,0,0:0.988,0

This can create an url request too large for the API to handle when using 
multiple markers.

Solution is to mark .,:|/\?&$=' as safe in function quote...

def quote(s):
    try:
        return  quote_plus(s.encode('utf-8'),r".,:|/\?&$='")
    except:
        return  quote_plus(s,r".,:|/\?&$='")

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by ricardo....@gmail.com on 21 Jun 2010 at 9:58

GoogleCodeExporter commented 9 years ago
Here are two sample urls...

works:

http://chart.apis.google.com/chart?chbh=13,1,1&chco=d8d870,666666&chd=t:98.8|0.0
,98.8&chm=%40yS'h\=10'f\fff'c\h-0-10'a,,0,0:0.072,0|%40yM'h\=10'f\fff'c\h-0-10'a
,,0,0:0.214,0|%40yT'h\=10'f\fff'c\h-0-10'a,,0,0:0.358,0|%40yW'h\=10'f\fff'c\h-0-
10'a,,0,0:0.5,0|%40yT'h\=10'f\fff'c\h-0-10'a,,0,0:0.643,0|%40yF'h\=10'f\fff'c\h-
0-10'a,,0,0:0.786,0|%40yS'h\=10'f\fff'c\h-0-10'a,,0,0:0.923,0|%40yl'h\=18'f\9090
00'c\l-0-13'a,,0,0:0.988,0|%40y166+kWh+used'h\=10'f\909000'c\-6-10'a,,0,0:0.988,
0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.143,0|%40ysq50'i\=1'=13'scl'\fff'c,,0,0.5:
0.143,0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.286,0|%40ysq50'i\=1'=13'scl'\fff'c,,
0,0.5:0.286,0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.429,0|%40ysq50'i\=1'=13'scl'\f
ff'c,,0,0.5:0.429,0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.571,0|%40ysq50'i\=1'=13'
scl'\fff'c,,0,0.5:0.571,0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.714,0|%40ysq50'i\=
1'=13'scl'\fff'c,,0,0.5:0.714,0|%40ysq75'i\=1'=13'scl'\fff'c,,0,0:0.857,0|%40ysq
50'i\=1'=13'scl'\fff'c,,0,0.5:0.857,0|%40ysq50'i\=1'=13'scl'\fff'c,,0,0.5:1.0,0|
%40yS'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.072,0|%40yM'h\=10'f\fff'c\h-0-10'a,,0,0.5:
0.214,0|%40yT'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.358,0|%40yW'h\=10'f\fff'c\h-0-10'a
,,0,0.5:0.5,0|%40yT'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.643,0|%40yF'h\=10'f\fff'c\h-
0-10'a,,0,0.5:0.786,0|%40yS'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.929,0|%40ysq'i\=880'
=13'scl'\c0c0c0'c,,0,0.5:0,0,-1|%40yl'h\=18'f\666666'c\l-0-13'a,,0,0.5:1.0,0|%40
y168+kWh+expected'h\=10'f\666666'c\-6-10'a,,0,0.5:1.0,0&chma=20,0,0,0&chs=1000x3
4&cht=bhs&chxl=2:|168.0+kWh+expected|166.0+kWh+used&chxs=0,ffffff,0,0,t|1,ffffff
,10,1,t|2,ffffff,10,-1,t,ffffff&chxt=x,y,r&chxtc=0,0|1,0|2,6

Doesn't Work:

http://chart.apis.google.com/chart?chbh=13,1,1&chco=d8d870,666666&chd=t:98.8|0.0
,98.8&chm=%40yS%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0:0.072,0|%40yM%27h%5C=1
0%27f%5Cfff%27c%5Ch-0-10%27a,,0,0:0.214,0|%40yT%27h%5C=10%27f%5Cfff%27c%5Ch-0-10
%27a,,0,0:0.358,0|%40yW%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0:0.5,0|%40yT%27
h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0:0.643,0|%40yF%27h%5C=10%27f%5Cfff%27c%5C
h-0-10%27a,,0,0:0.786,0|%40yS%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0:0.923,0|
%40yl%27h%5C=18%27f%5C909000%27c%5Cl-0-13%27a,,0,0:0.988,0|%40y166+kWh+used%27h%
5C=10%27f%5C909000%27c%5C-6-10%27a,,0,0:0.988,0|%40ysq75%27i%5C=1%27=13%27scl%27
%5Cfff%27c,,0,0:0.143,0|%40ysq50%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0.5:0.143,
0|%40ysq75%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0:0.286,0|%40ysq50%27i%5C=1%27=1
3%27scl%27%5Cfff%27c,,0,0.5:0.286,0|%40ysq75%27i%5C=1%27=13%27scl%27%5Cfff%27c,,
0,0:0.429,0|%40ysq50%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0.5:0.429,0|%40ysq75%2
7i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0:0.571,0|%40ysq50%27i%5C=1%27=13%27scl%27%5
Cfff%27c,,0,0.5:0.571,0|%40ysq75%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0:0.714,0|
%40ysq50%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0.5:0.714,0|%40ysq75%27i%5C=1%27=1
3%27scl%27%5Cfff%27c,,0,0:0.857,0|%40ysq50%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,
0.5:0.857,0|%40ysq50%27i%5C=1%27=13%27scl%27%5Cfff%27c,,0,0.5:1.0,0|%40yS%27h%5C
=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0.5:0.072,0|%40yM%27h%5C=10%27f%5Cfff%27c%5Ch-
0-10%27a,,0,0.5:0.214,0|%40yT%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0.5:0.358,
0|%40yW%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0.5:0.5,0|%40yT%27h%5C=10%27f%5C
fff%27c%5Ch-0-10%27a,,0,0.5:0.643,0|%40yF%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,
0,0.5:0.786,0|%40yS%27h%5C=10%27f%5Cfff%27c%5Ch-0-10%27a,,0,0.5:0.929,0|%40ysq%2
7i%5C=880%27=13%27scl%27%5Cc0c0c0%27c,,0,0.5:0,0,-1|%40yl%27h%5C=18%27f%5C666666
%27c%5Cl-0-13%27a,,0,0.5:1.0,0|%40y168+kWh+expected%27h%5C=10%27f%5C666666%27c%5
C-6-10%27a,,0,0.5:1.0,0&chma=20,0,0,0&chs=1000x34&cht=bhs&chxl=2:|168.0+kWh+expe
cted|166.0+kWh+used&chxs=0,ffffff,0,0,t|1,ffffff,10,1,t|2,ffffff,10,-1,t,ffffff&
chxt=x,y,r&chxtc=0,0|1,0|2,6

Original comment by ricardo....@gmail.com on 21 Jun 2010 at 10:03

GoogleCodeExporter commented 9 years ago
might as well mark @ as safe as well...

r".,:|/\?&$='@"

resulting url:

http://chart.apis.google.com/chart?chbh=13,1,1&chco=d8d870,666666&chd=t:98.8|0.0
,98.8&chm=@yS'h\=10'f\fff'c\h-0-10'a,,0,0:0.072,0|@yM'h\=10'f\fff'c\h-0-10'a,,0,
0:0.214,0|@yT'h\=10'f\fff'c\h-0-10'a,,0,0:0.358,0|@yW'h\=10'f\fff'c\h-0-10'a,,0,
0:0.5,0|@yT'h\=10'f\fff'c\h-0-10'a,,0,0:0.643,0|@yF'h\=10'f\fff'c\h-0-10'a,,0,0:
0.786,0|@yS'h\=10'f\fff'c\h-0-10'a,,0,0:0.923,0|@yl'h\=18'f\909000'c\l-0-13'a,,0
,0:0.988,0|@y166+kWh+used'h\=10'f\909000'c\-6-10'a,,0,0:0.988,0|@ysq75'i\=1'=13'
scl'\fff'c,,0,0:0.143,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.143,0|@ysq75'i\=1'=1
3'scl'\fff'c,,0,0:0.286,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.286,0|@ysq75'i\=1'
=13'scl'\fff'c,,0,0:0.429,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.429,0|@ysq75'i\=
1'=13'scl'\fff'c,,0,0:0.571,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.571,0|@ysq75'i
\=1'=13'scl'\fff'c,,0,0:0.714,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.714,0|@ysq75
'i\=1'=13'scl'\fff'c,,0,0:0.857,0|@ysq50'i\=1'=13'scl'\fff'c,,0,0.5:0.857,0|@ysq
50'i\=1'=13'scl'\fff'c,,0,0.5:1.0,0|@yS'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.072,0|@y
M'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.214,0|@yT'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.358,
0|@yW'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.5,0|@yT'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.64
3,0|@yF'h\=10'f\fff'c\h-0-10'a,,0,0.5:0.786,0|@yS'h\=10'f\fff'c\h-0-10'a,,0,0.5:
0.929,0|@ysq'i\=880'=13'scl'\c0c0c0'c,,0,0.5:0,0,-1|@yl'h\=18'f\666666'c\l-0-13'
a,,0,0.5:1.0,0|@y168+kWh+expected'h\=10'f\666666'c\-6-10'a,,0,0.5:1.0,0&chma=20,
0,0,0&chs=1000x34&cht=bhs&chxl=2:|168.0+kWh+expected|166.0+kWh+used&chxs=0,fffff
f,0,0,t|1,ffffff,10,1,t|2,ffffff,10,-1,t,ffffff&chxt=x,y,r&chxtc=0,0|1,0|2,6

Original comment by ricardo....@gmail.com on 21 Jun 2010 at 10:13