I was making this app where it gets data from Google Spreadsheet 
This is the code I used to get data from my Spreadsheet : 

json_key = json.load(open('service.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], 
json_key['private_key'], scope)
self.gc = gspread.authorize(credentials)
self.sheet = self.gc.open('Order Database').sheet1
self.menuSheet = self.gc.open('Menu and Stocking').sheet1
return self.menuSheet.get_all_values()

At the beginning the code was working fine, I was using OAuth 2.0 client 
IDs.
Later when I was working with my android app, to get the data from the 
website on that url, I started getting Internal Server 500 error, and I can 
access to that url even from chrome where other part of my website works 
fine. While searching for solution, I found some people saying to use a API 
Keys, so I created a server key and even used that, this is the android 
 code : 

HttpClient client = new DefaultHttpClient();
HttpGet request =new HttpGet(url);
request.addHeader("x-api-key",apikey);
HttpResponse response = client.execute(request);
BufferReader rd = new BufferReader(new InputStreamReader(response.getEntity
().getContent()));
String line = rd.readLine();

The code works fine, at least thats what I think. Every time I get the 
Internal Server Error 500, if I deploy it again, it starts working fine, 
but only for a while, soon it starts showing the same error. Looking 
through the Dashboard of my project I found some detail of the error so I 
will also include that here : 

HTTPError: 401: <HTML> <HEAD> <TITLE>Unauthorized</TITLE> </HEAD> <BODY 
BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Unauthorized</H1> <H2>Error 401</H2> 
</BODY> 
</HTML>

   1. 
      1. at request (/base/data/home/apps/s~gowcanteen/1.394247265273324301/
      lib/gspread/httpsession.py:75 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fgspread%2Fhttpsession.py&line=75&project=gowcanteen>
      )
      2. at get (/base/data/home/apps/s~gowcanteen/1.394247265273324301/lib/
      gspread/httpsession.py:79 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fgspread%2Fhttpsession.py&line=79&project=gowcanteen>
      )
      3. at get_cells_feed (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/lib/gspread/client.py:250 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fgspread%2Fclient.py&line=250&project=gowcanteen>
      )
   2. 
   3. 
      1. at getMenuItems (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/server.py:24 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Fserver.py&line=24&project=gowcanteen>
      )
      2. at API_MENU (/base/data/home/apps/s~gowcanteen/1.394247265273324301
      /main.py:61 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Fmain.py&line=61&project=gowcanteen>
      )
      3. at dispatch_request (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/lib/flask/app.py:1461 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fflask%2Fapp.py&line=1461&project=gowcanteen>
      )
      4. at full_dispatch_request (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/lib/flask/app.py:1475 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fflask%2Fapp.py&line=1475&project=gowcanteen>
      )
      5. at handle_user_exception (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/lib/flask/app.py:1381 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fflask%2Fapp.py&line=1381&project=gowcanteen>
      )
      6. at full_dispatch_request (/base/data/home/apps/s~gowcanteen/
      1.394247265273324301/lib/flask/app.py:1477 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fflask%2Fapp.py&line=1477&project=gowcanteen>
      )
      7. at wsgi_app (/base/data/home/apps/s~gowcanteen/1.394247265273324301
      /lib/flask/app.py:1817 
      
<https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=1&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~gowcanteen%2F1.394247265273324301%2Flib%2Fflask%2Fapp.py&line=1817&project=gowcanteen>
      )
   

I am new to developing and have very little knowledge about OAuths and 
Credentials, so there might be issues that I do not know and thats why 
unable to find the problem and fix it. I have added everything that I could 
think of that could have been related to this issue, so please I ask for 
your help.  

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/5ff7fd65-dd69-4aa7-b6b9-8440006a8347%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to