Skip to content

Setting cache to suds.cache.NoCache as described in the README causes an AttributeError to be raised. #177

@kavdev

Description

@kavdev

NoCache Instructions

https://github.com/googleads/googleads-python-lib#how-can-i-configure-or-disable-caching-for-the-suds-client

Traceback

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/app/motimatic/apps/scheduling/utils.py", line 14, in get_performance_data
    results = explorer.get_performance_data(date)
  File "/app/motimatic/apps/scheduling/network_explorers.py", line 199, in get_performance_data
    report_downloader = cls.adwords_client.GetReportDownloader(version="v201609")
  File "/app/.heroku/python/lib/python3.4/site-packages/googleads/adwords.py", line 441, in GetReportDownloader
    return ReportDownloader(self, version, server)
  File "/app/.heroku/python/lib/python3.4/site-packages/googleads/adwords.py", line 1169, in __init__
    cache=self._adwords_client.cache).wsdl.schema
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/client.py", line 113, in __init__
    self.set_options(**kwargs)
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/client.py", line 133, in set_options
    p.update(kwargs)
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/properties.py", line 255, in update
    self.set(n, v)
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/properties.py", line 280, in set
    self.provider(name).__set(name, value)
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/properties.py", line 420, in __set
    d.validate(value)
  File "/app/.heroku/python/lib/python3.4/site-packages/suds/properties.py", line 180, in validate
    raise AttributeError(msg)
AttributeError: "cache" must be: (<class 'suds.cache.Cache'>,)

Client Config

from django.conf import settings
from googleads.adwords import AdWordsClient
from googleads.oauth2 import GoogleRefreshTokenClient
from suds.cache import NoCache
from motimatic.manage import get_env_variable

oauth2_client = GoogleRefreshTokenClient(
    client_id=settings.GOOGLE_ADWORDS_OAUTH2_CLIENT_ID,
    client_secret=settings.GOOGLE_ADWORDS_OAUTH2_CLIENT_SECRET,
    refresh_token=settings.GOOGLE_ADWORDS_OAUTH2_REFRESH_TOKEN
)

cls.adwords_client = AdWordsClient(
    developer_token=settings.GOOGLE_ADWORDS_DEVELOPER_TOKEN,
    oauth2_client=oauth2_client,
    user_agent="Motimatic Explorer {}".format(get_env_variable("HEROKU_RELEASE_VERSION", "v?")),
    client_customer_id=settings.GOOGLE_ADWORDS_CUSTOMER_ID,
    cache=NoCache
)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions