M
M
mvk8432021-04-09 13:46:29
Python
mvk843, 2021-04-09 13:46:29

Python + Yandex Direct API: how to get LocationOfPresenceName correctly?

I have a Python script that uploads Yandex.Direct data via API to Google Big Query. Among other things, I upload LocationOfPresenceName or TargetingLocationName, but in the upload I get values ​​like pїЅpїЅpїЅpїЅpїЅpїS. How to get values ​​in normal encoding? I am attaching the script just in case, with a link, since there is not enough space for the text here.

Script

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mvk843, 2021-04-14
@mvk843

If you're interested, I figured it out. The problem was in the get_ads_stat function. There is a line there:
data = pd.read_csv(TSV_PATH + name + '.txt', sep='\t', encoding='cp1251'
) intermediate saving to a text file goes exactly in it, and by default it apparently reads as utf8. After that, all values ​​are displayed correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question