Yes its windows and its in development server :D btw, after I deployed
it, this problem disappear! thanks for the response!

On 6/21/11, Brandon Wirtz <[email protected]> wrote:
> Those look like windows errors, is this app deployed?
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Taufiq Sunar
> Sent: Monday, June 20, 2011 5:10 AM
> To: [email protected]
> Subject: [google-appengine] TypeError: escape_encode() argument 1 must be
> str, not unicode
>
> Im trying to make a url shortener using Google URL Shortener API with App
> Engine
>
> this is my source code in main.py
>
> from google.appengine.ext import webapp
> from google.appengine.ext.webapp import util from xml.dom import minidom
> from google.appengine.ext.webapp.util import run_wsgi_app import httplib,
> json import cgi
>
> class MainPage(webapp.RequestHandler):
>     def get(self):
>         self.response.out.write("""
>           <html>
>           <head>
>           <title>Simple Url Shortener</title>
>             <body>
>             Url shortener using Google URL Shortener API. Masukkan url yang
> pengen dipendekin.
>               <form action="/hasil" method="post">
>                 <div>Url</div><div><textarea name="url" rows="1"
> cols="50"></textarea></div>
>                 <div><input type="submit" value="Cari"></div>
>               </form>
>             </body>
>           </html>""")
>
> class Cari(webapp.RequestHandler):
>     def post(self):   
>       url = self.request.get('url')
>       conn = httplib.HTTPSConnection('www.googleapis.com')
>         conn.connect();
>
>         short = '"'+url+'"'
>
>         body = '{"longUrl": %s}' % short
>         headers = {'content-type':'application/json'}
>
>         conn.request('POST', '/urlshortener/v1/url', body, headers)
>
>         response = json.loads(conn.getresponse().read())
>
>         self.response.out.write('<html><title>Simple Url
> Shortener</title><body>Url yang sudah dipendekin dari ', url, '
> :<pre>')
>         self.response.out.write(response["id"])
>       self.response.out.write('</pre></body></html>')
>
> application = webapp.WSGIApplication([('/', MainPage), ('/hasil', Cari)],
> debug=True)
>
> def main():
>     run_wsgi_app(application)
>
> if __name__ == '__main__':
>     main()
>
> and its get error message :
>
> Traceback (most recent call last):
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py",
> line 702, in __call__
>     handler.post(*groups)
>   File "D:\latian web\url shortener\main.py", line 55, in post
>     response = json.loads(conn.getresponse().read())
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\dist\httplib.py", line 213,
> in getresponse
>     self._allow_truncated, self._follow_redirects)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\urlfetch.py", line 260,
> in fetch
>     return rpc.get_result()
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py",
> line 592, in get_result
>     return self.__get_result_hook(self)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\urlfetch.py", line 348,
> in _get_fetch_result
>     rpc.check_success()
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py",
> line 558, in check_success
>     self.__rpc.CheckSuccess()
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\apiproxy_rpc.py",
> line 156, in _WaitImpl
>     self.request, self.response)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\apiproxy_stub.py",
> line 87, in MakeSyncCall
>     method(request, response)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\urlfetch_stub.py",
> line 207, in _Dynamic_Fetch
>     validate_certificate=validate_certificate)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\api\urlfetch_stub.py",
> line 294, in _RetrieveURL
>     escaped_payload = payload.encode('string_escape')
> TypeError: escape_encode() argument 1 must be str, not unicode
>
> anybody knows what should i do to troubleshoot this?
> i use httplib module to make a connection and request.
>
> Best regards,
>
> Taufiq Sunar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to