crossplatform.ru

Здравствуйте, гость ( Вход | Регистрация )

 
Ответить в данную темуНачать новую тему
> Кто ставил google api для питона?
Гость_xxxXXXxxx_*
сообщение 29.9.2014, 6:46
Сообщение #1





Гости








    


Всем доброго времени суток. второй день пытаюсь установить Google Api под язык python и одинаково безуспешно по windows и linux осями. Кто с этим сталкивался, помогите. Просьба не отсылать в хелп гугла, т.к. там все врут :)

#!/usr/bin/python
# -*- coding: utf-8 -*-

import hashlib
from oauth2client import gce
import pickle
from google.appengine.api import memcache
...

Результат:
Traceback (most recent call last):
  File "a2gc.py", line 9, in <module>
    from google.appengine.api import memcache
ImportError: No module named google.appengine.api
Перейти в начало страницы
 
Быстрая цитата+Цитировать сообщение
Гость_xxxXXXxxx_*
сообщение 10.10.2014, 9:41
Сообщение #2





Гости








    


Снова всем привет. Таки я достучался до всей этой хрени и даже авторизовался, но, блин, у меня проблемы связанные с расхождением в документации.
Цитата("Google")
from apiclient.discovery import build
service = build('api_name', 'api_version', ...)

collection = service.stamps()

or

nested_collection = service.featured().stamps()


АЗАЗАЗАЗАЗАААЗЗЗЗЗ....


Но, ассемблер их дери:
gc = build('calendar', 'v3', http=http_auth)
collection = gc.stamps()


Цитата("Консоль")
AttributeError: 'Resource' object has no attribute 'stamps'


А все почему - потому что:
$ python
>>> help()
help> apiclient.discovery.Resource

apiclient.discovery.Resource = class Resource(__builtin__.object)
|  A class for interacting with a resource.
|  
|  Methods defined here:
|  
|  __getstate__(self)
|      Trim the state down to something that can be pickled.
|      
|      Uses the fact that the instance variable _dynamic_attrs holds attrs that
|      will be wiped and restored on pickle serialization.
|  
|  __init__(self, http, baseUrl, model, requestBuilder, developerKey, resourceDesc, rootDesc, schema)
|      Build a Resource from the API description.
|      
|      Args:
|        http: httplib2.Http, Object to make http requests with.
|        baseUrl: string, base URL for the API. All requests are relative to this
|            URI.
|        model: apiclient.Model, converts to and from the wire format.
|        requestBuilder: class or callable that instantiates an
|            apiclient.HttpRequest object.
|        developerKey: string, key obtained from
|            https://code.google.com/apis/console
|        resourceDesc: object, section of deserialized discovery document that
|            describes a resource. Note that the top level discovery document
|            is considered a resource.
|        rootDesc: object, the entire deserialized discovery document.
|        schema: object, mapping of schema names to schema descriptions.
|  
|  __setstate__(self, state)
|      Reconstitute the state of the object from being pickled.
|      
|      Uses the fact that the instance variable _dynamic_attrs holds attrs that
|      will be wiped and restored on pickle serialization.
|  
|  ----------------------------------------------------------------------
|  Data descriptors defined here:
|  
|  __dict__
|      dictionary for instance variables (if defined)
|  
|  __weakref__
|      list of weak references to the object (if defined)


И у него тупо нет этих методов/атрибутов.
Как с этим бороться?

Решил сделать интроспекцию по модулю ... о мой мозг....

Еще раз всем спасибо за помощь.
Перейти в начало страницы
 
Быстрая цитата+Цитировать сообщение
Гость_xxxXXXxxx_*
сообщение 13.10.2014, 8:51
Сообщение #3





Гости








    


Всем спасибо. Тему можно закрывать.
Перейти в начало страницы
 
Быстрая цитата+Цитировать сообщение

Быстрый ответОтветить в данную темуНачать новую тему
Теги
Нет тегов для показа


1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0




RSS Текстовая версия Сейчас: 29.3.2024, 18:30