crossplatform.ru

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


  Ответ в Кто ставил google api для питона?
Введите ваше имя
Подтвердите код

Введите в поле код из 6 символов, отображенных в виде изображения. Если вы не можете прочитать код с изображения, нажмите на изображение для генерации нового кода.
 

Опции сообщения
 Включить смайлы?
Иконки сообщения
(Опционально)
                                
                                
  [ Без иконки ]
 


Последние 10 сообщений [ в обратном порядке ]
xxxXXXxxx Дата 13.10.2014, 8:51
  Всем спасибо. Тему можно закрывать.
xxxXXXxxx Дата 10.10.2014, 9:41
  Снова всем привет. Таки я достучался до всей этой хрени и даже авторизовался, но, блин, у меня проблемы связанные с расхождением в документации.
Цитата("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 Дата 29.9.2014, 6:46
  Всем доброго времени суток. второй день пытаюсь установить 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
Просмотр темы полностью (откроется в новом окне)
RSS Текстовая версия Сейчас: 29.3.2024, 8:24