2012-02-02 4 views
5

Sto cercando di recuperare un utente con il seguente codice trovato nello gdata provisioning api documentation. Sto tentando questo per un app django 1.3, in esecuzione gdata-2.0.16 in python2.7:"Richieste HTTP non protette non consentite. Utilizza HTTPS." durante il tentativo di recupero dell'utente con la libreria python gdata 2.0.16

from gdata.apps import client 
from myapp import settings 
client = client.AppsClient(domain=settings.GOOGLE_ADMIN_DOMAIN) 
client.ClientLogin(email=settings.GOOGLE_ADMIN_EMAIL, password=settings.GOOGLE_ADMIN_PASSWORD, source='apps') 
user_account = client.RetrieveUser('user_name') 

per la privacy, ho cambiato il nome utente effettivo 'user_name', ma questo è il senso generale del codice.

Quando l'interprete arriva all'ultima riga nel codice precedente, ottengo il seguente errore:

Traceback (most recent call last): 
    File "<console>", line 1, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/gdata/apps/client.py", line 182, in RetrieveNickname 
    return self.GetEntry(uri, desired_class=gdata.apps.data.NicknameEntry) 
    File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 652, in get_entry 
    desired_class=desired_class, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 319, in request 
    RequestError) 
RequestError: Server responded with: 403, <HTML> 
<HEAD> 
<TITLE>Insecure HTTP requests not permitted. Use HTTPS.</TITLE> 
</HEAD> 
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"> 
<H1>Insecure HTTP requests not permitted. Use HTTPS.</H1> 
<H2>Error 403</H2> 
</BODY> 
</HTML> 

non riesco a trovare nulla nella documentazione sull'uso di HTTPS al posto di HTTP. Cosa mi manca?

risposta

8

Dopo aver creato l'oggetto client, eseguire client.ssl = True. Questo farà sì che gdata api usi una connessione sicura.

0

Prova cerotto attaccato alla Comment 3 del AppsService problema nel mercato - SSL emette

0

aggiungendo la riga dopo l'autenticazione del client aiuta client.ssl ​​= True.

Problemi correlati