Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: can't pickle CompiledFFI objects #397

Open
benpowis opened this issue May 2, 2019 · 5 comments
Open

TypeError: can't pickle CompiledFFI objects #397

benpowis opened this issue May 2, 2019 · 5 comments
Assignees

Comments

@benpowis
Copy link

benpowis commented May 2, 2019

Originally posted this on the group for the AdWords API, but have been redirected here.

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/adwords-api/5pDjjmSuWSE/3zeaZcBCAQAJ

I am trying to programmatically add/update user lists in AdWords, I;ve got to the code so far by following code examples in the docs, but when I try to create a list I get the error TypeError: can't pickle CompiledFFI objects, and I can't work out how to get around it!

from googleads import oauth2

key_file='my_key.json'
application_name = "test"

# Initialize the GoogleRefreshTokenClient using the credentials you received
# in the earlier steps.
oauth2_client = oauth2.GoogleServiceAccountClient(
    key_file, oauth2.GetAPIScope('adwords'))

# Initialize the Ad Manager client.
client = adwords.AdWordsClient(oauth2_client, application_name)

user_list_service = client.GetService('AdwordsUserListService', 'v201809')

user_list = {
      'xsi_type': 'CrmBasedUserList',
      'name': 'Test list #%d' % uuid.uuid4(),
      'description': 'A test list',
      # CRM-based user lists can use a membershipLifeSpan of 10000 to indicate
      # unlimited; otherwise normal values apply.
      'membershipLifeSpan': 30,
      'uploadKeyType': 'CONTACT_INFO'
  }

# Create an operation to add the user list.
operations = [{
    'operator': 'ADD',
    'operand': user_list
}]

result = user_list_service.mutate(operations)

And here is the full error:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-43-797ee50d19e7> in <module> 5 }] 6 ----> 7 result = user_list_service.mutate(operations) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args) 1380 try: 1381 return soap_service_method( -> 1382 *packed_args, _soapheaders=soap_headers)['body']['rval'] 1383 except zeep.exceptions.Fault as e: 1384 error_list = () ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\proxy.py in __call__(self, *args, **kwargs) 40 return self._proxy._binding.send( 41 self._proxy._client, self._proxy._binding_options, ---> 42 self._op_name, args, kwargs) 43 44 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in send(self, client, options, operation, args, kwargs) 119 operation, args, kwargs, 120 client=client, --> 121 options=options) 122 123 response = client.transport.post_xml( ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in _create(self, operation, args, kwargs, client, options) 66 67 # Create the SOAP envelope ---> 68 serialized = operation_obj.create(*args, **kwargs) 69 self._set_http_headers(serialized, operation_obj) 70 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\definitions.py in create(self, *args, **kwargs) 198 199 def create(self, *args, **kwargs): --> 200 return self.input.serialize(*args, **kwargs) 201 202 def process_reply(self, envelope): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\messages\soap.py in serialize(self, *args, **kwargs) 61 # Create the soap:header element 62 headers_value = kwargs.pop('_soapheaders', None) ---> 63 header = self._serialize_header(headers_value, nsmap) 64 if header is not None: 65 envelope.append(header) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\messages\soap.py in _serialize_header(self, headers_value, nsmap) 322 return 323 --> 324 headers_value = copy.deepcopy(headers_value) 325 326 soap = ElementMaker(namespace=self.nsmap['soap-env'], nsmap=nsmap) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 159 copier = getattr(x, "__deepcopy__", None) 160 if copier: --> 161 y = copier(memo) 162 else: 163 reductor = dispatch_table.get(cls) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\xsd\valueobjects.py in __deepcopy__(self, memo) 144 def __deepcopy__(self, memo): 145 new = type(self)() --> 146 new.__values__ = copy.deepcopy(self.__values__) 147 for attr, value in self.__dict__.items(): 148 if attr != '__values__': ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 304 for key, value in dictiter: 305 key = deepcopy(key, memo) --> 306 value = deepcopy(value, memo) 307 y[key] = value 308 else: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 167 reductor = getattr(x, "__reduce_ex__", None) 168 if reductor: --> 169 rv = reductor(4) 170 else: 171 reductor = getattr(x, "__reduce__", None) TypeError: can't pickle CompiledFFI objects

@BenRKarl
Copy link
Contributor

Hi @benpowis apologies for my delayed response! At first glance I'm not sure what the exact problem is here. I've seen issues in the past related to packages specific to anaconda. Do you think you could paste the contents of running pip freeze so I can see what versions of our dependencies you have installed?

@BenRKarl BenRKarl self-assigned this Jun 28, 2019
@jvelonis
Copy link

I'm getting the same error listing campaigns:

from googleads import adwords
from googleads import oauth2

PAGE_SIZE = 100


def main(client):
    # Initialize appropriate service.
    campaign_service = client.GetService('CampaignService', version='v201809')

    # Construct selector and get all campaigns.
    offset = 0
    selector = {
        'fields': ['Id', 'Name', 'Status'],
        'paging': {
            'startIndex': str(offset),
            'numberResults': str(PAGE_SIZE)
        }
    }

    more_pages = True
    while more_pages:
        page = campaign_service.get(selector)

        # Display results.
        if 'entries' in page:
            for campaign in page['entries']:
                print('Campaign with id "%s", name "%s", and status "%s" was '
                    'found.' % (campaign['id'], campaign['name'],
                    campaign['status']))
        else:
            print('No campaigns were found.')
        offset += PAGE_SIZE
        selector['paging']['startIndex'] = str(offset)
        more_pages = offset < int(page['totalNumEntries'])


if __name__ == '__main__':
    # Initialize the GoogleRefreshTokenClient using the JSON credentials
    oauth2_client = oauth2.GoogleServiceAccountClient(
        'my_key_file.json', oauth2.GetAPIScope('ad_manager'))

    adwords_client = adwords.AdWordsClient(oauth2_client, 'my_app')
    main(adwords_client)

Here's the stack trace:

Traceback (most recent call last):
  File "get_campaigns.py", line 73, in <module>
    main(adwords_client)
  File "get_campaigns.py", line 41, in main
    page = campaign_service.get(selector)
  File "/usr/local/lib/python3.7/site-packages/googleads/common.py", line 992, in MakeSoapRequest
    *packed_args, _soapheaders=soap_headers)['body']['rval']
  File "/usr/local/lib/python3.7/site-packages/zeep/proxy.py", line 45, in __call__
    kwargs,
  File "/usr/local/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 119, in send
    operation, args, kwargs, client=client, options=options
  File "/usr/local/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 68, in _create
    serialized = operation_obj.create(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/zeep/wsdl/definitions.py", line 215, in create
    return self.input.serialize(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/zeep/wsdl/messages/soap.py", line 59, in serialize
    header = self._serialize_header(headers_value, nsmap)
  File "/usr/local/lib/python3.7/site-packages/zeep/wsdl/messages/soap.py", line 326, in _serialize_header
    headers_value = copy.deepcopy(headers_value)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 161, in deepcopy
    y = copier(memo)
  File "/usr/local/lib/python3.7/site-packages/zeep/xsd/valueobjects.py", line 151, in __deepcopy__
    new.__values__ = copy.deepcopy(self.__values__)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 306, in _reconstruct
    value = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 169, in deepcopy
    rv = reductor(4)
TypeError: can't pickle CompiledFFI objects

My installed libraries:

$ pip freeze
WARNING: Could not generate requirement for distribution -equests 2.21.0 (/usr/local/lib/python3.7/site-packages): Parse error at "'-equests'": Expected W:(abcd...)
ansiwrap==0.8.4
appdirs==1.4.3
appnope==0.1.0
asn1crypto==0.24.0
atomicwrites==1.3.0
attrs==19.1.0
autograd==1.3
autograd-gamma==0.4.1
awscli==1.16.225
azure-common==1.1.18
azure-storage-blob==1.5.0
azure-storage-common==1.4.0
backcall==0.1.0
bleach==3.1.0
boto3==1.9.211
botocore==1.12.215
cached-property==1.5.1
cachetools==3.1.0
certifi==2019.3.9
cffi==1.12.2
chardet==3.0.4
Click==7.0
colorama==0.3.9
cryptography==2.6.1
cycler==0.10.0
cypari==2.3.0
decorator==4.4.0
defusedxml==0.6.0
dill==0.3.1.1
docutils==0.14
entrypoints==0.3
fastparquet==0.3.2
future==0.17.1
FXrays==1.3.3
google-api-python-client==1.7.8
google-auth==1.6.3
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.1
googleads==23.0.1
gspread==3.1.0
heroku3==3.4.0
httplib2==0.12.3
idna==2.8
ijson==2.3
importlib-metadata==0.23
ipykernel==5.1.2
ipython==7.8.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
isodate==0.6.0
jedi==0.15.1
Jinja2==2.10.3
jmespath==0.9.3
jsonschema==3.1.1
jupyter==1.0.0
jupyter-client==5.3.4
jupyter-console==6.0.0
jupyter-core==4.6.0
kiwisolver==1.1.0
lifelines==0.22.3
llvmlite==0.29.0
lxml==4.5.0
MarkupSafe==1.1.1
matplotlib==3.1.1
mistune==0.8.4
more-itertools==6.0.0
mpld3==0.3
nbconvert==5.6.0
nbformat==4.4.0
nbresuse==0.3.2
networkx==2.3
notebook==6.0.1
numba==0.45.1
numpy==1.17.0
oauth2client==4.1.3
oauthlib==3.1.0
pandas==0.25.3
pandocfilters==1.4.2
papermill==1.2.1
parso==0.5.1
patsy==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
plink==2.3
plotly==4.4.1
pluggy==0.9.0
prometheus-client==0.7.1
prompt-toolkit==2.0.9
psutil==5.6.5
ptyprocess==0.6.0
py==1.8.0
pyasn1==0.4.4
pyasn1-modules==0.2.5
pycparser==2.19
pycryptodomex==3.8.0
pygal==2.4.0
Pygments==2.4.2
PyJWT==1.7.1
pynb==0.1.36
pyOpenSSL==19.0.0
pyparsing==2.4.2
pypng==0.0.20
pyrsistent==0.15.4
pytest==4.3.1
python-dateutil==2.7.4
python-snappy==0.5.4
pytz==2018.9
PyYAML==5.3.1
pyzmq==18.1.0
qtconsole==4.5.5
requests==2.22.0
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
retrying==1.3.3
rsa==3.4.2
s3transfer==0.2.1
scipy==1.3.1
Send2Trash==1.5.0
simplejson==3.3.1
six==1.11.0
snappy-manifolds==1.1
snowflake-connector-python==1.7.10
snowflake-sqlalchemy==1.1.14
spherogram==1.8.2
SQLAlchemy==1.3.7
statsmodels==0.10.2
tenacity==6.0.0
terminado==0.8.2
testpath==0.4.2
textwrap3==0.9.2
thrift==0.11.0
tornado==6.0.3
tqdm==4.41.1
traitlets==4.3.2
uritemplate==3.0.0
urllib3==1.24
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.5.1
xmltodict==0.12.0
zeep==3.4.0
zipp==0.6.0

@qwert666
Copy link

qwert666 commented Apr 7, 2020

@BenRKarl Any updates on this issue?
Getting exactly the same errors, tried to debug it a bit but can't find anything besides that it apparently passes a non-serializable object to soap_header and tries to serialize google.auth.crypt._cryptography_rsa.RSASigner and I guess it shouldn't do that?

@jamesclyeh
Copy link

jamesclyeh commented Sep 3, 2020

I think the problem is that _http inside googleapiclient.discovery.Resource is not registered as a dynamic_attr and as a result getstate does not delete it.

@6utt3rfly
Copy link

I'm new to python and came across this too. I think it's a mismatch between the wiki documentation for JWT auth and the code. Once I changed to this, it started working:

oauth2_client = oauth2.GoogleServiceAccountClient(
    'my-file-name.json',
    oauth2.GetAPIScope('adwords'),
    '[email protected]' # optional
)
client = adwords.AdWordsClient(
    'my-developer-token',
    oauth2_client,
    'my-app-name',
    client_customer_id='###-###-####'
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants