Encoding error on Search Terms report #147
Unanswered
vgarciasouza
asked this question in
Q&A
Replies: 2 comments
-
Hello @vgarciasouza, Kind regards, |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello @KritikoAlex , Today, I successfully resolved the error that occurred when downloading as 'json'. In the file client.py, on line 153, it's necessary to add encoding='UTF-8', so the line should be:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, and first of all, thank for your help.
On the "spSearchTerm" report I get an encoding error when downloading if there was a "searchterm" with special caracters in the day (eg. "searchTerm": "狗狗厕所")
Here's my code line where raises the error:
ads_client.download_report( url=url, format='json', file=str(report_file.absolute()), encoding='utf-8')
and this is what I get;
\utils\ads_reports.py", line 109, in download_report_to_csv ads_client.download_report( File "\ad_api\api\reports.py", line 70, in download_report return self._download(self, params=kwargs, headers={'User-Agent': self.user_agent}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \ad_api\base\client.py", line 156, in _download fo.write(read_data.decode('UTF-8')) \Lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'charmap' codec can't encode characters in position 15032-15035: character maps to <undefined>
Beta Was this translation helpful? Give feedback.
All reactions