Posts tagged with python

I'm trying to modularize a type of report from the API. This is my query for the request:

content = ['CampaignId', 'AdvertisingChannelType', ...] report_query = (adwords.ReportQueryBuilder()                        .Select(content)                        .From('CAMPAIGN_PERFORMANCE_REPORT')                        .During(start_date=since,end_date=until)                        .Build()) 

However, I'm having a problem with the .Select() statement since its common usage is .Select('CampaignId', 'AdvertisingChannelType', ...) (as the list but without the brackets []) and in my query I'm parsing the arguments as a list, which of course returns an error.

My question is, how can I parse the elements of content as required? I've tried turning the list into a string but it doesn't work as all the list becomes a single element. I can't assign by hand the elements since it's number may vary (will be used for more than one client).

Any help will be appreciated. Thanks!

I have my own Whatsapp business account. I want to have a client that can:

  1. Alert me when I get a new message
  2. Be able to send an automatic reply based on the original message I've received.

I've searched the web for ready open source python clients I can use and found only one that might be suitable - https://pypi.org/project/wabclient/ The problem - there is no documentation on how to use it, reviews etc. Are there any other open sources I can use to achieve my goal? Any sample projects that use wabclient?

Tried Option didn't work used in app.py

os.environ['PYTHONHTTPSVERIFY'] = '0' ssl._create_default_https_context = ssl._create_unverified_context 

using flask

data = report_downloader.DownloadReport( report, output, skip_report_header=False, skip_column_header=False, skip_report_summary=False, include_zero_impressions=True) 

and trying to get ACCOUNT_PERFORMANCE_REPORT working fine on local system when used tiangolo/uwsgi-nginx-flask:python3.6 as docker base image and deployed giving below error

 File "/google-analytics/helper_service/service.py", line 328, in sync_google_ads_word_data skip_report_summary=False, include_zero_impressions=True) File "/usr/local/lib/python3.6/site-packages/googleads/common.py", line 405, in Wrapper return utility_method(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/googleads/adwords.py", line 1268, in DownloadReport output, **kwargs) File "/usr/local/lib/python3.6/site-packages/googleads/adwords.py", line 1540, in _DownloadReport response = self._DownloadReportAsStream(post_body, **kwargs) File "/usr/local/lib/python3.6/site-packages/googleads/adwords.py", line 1614, in _DownloadReportAsStream response = self.url_opener.open(request) File "/usr/local/lib/python3.6/urllib/request.py", line 526, in open response = self._open(req, data) File "/usr/local/lib/python3.6/urllib/request.py", line 544, in _open '_open', req) File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/usr/local/lib/python3.6/urllib/request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "/usr/local/lib/python3.6/urllib/request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)> 

Tasked with writing a client to interact with Google Ad Manager. From what I can tell there are three "official" python client libraries on PyPi released by Google. One seems to be legacy, as indicated in its README, but the other two seem to be actively developed.

https://github.com/googleapis/google-api-python-client (Legacy, first release = 2011)

https://github.com/googleads/googleads-python-lib (first release = 2014)

https://github.com/googleads/google-ads-python (first release = 2018)

The latter two have the same three developers. Which to use?

I am trying to make a WhatsApp bot inspired by the functioning of Discord bots, the bot will work in WhatsApp groups.

I have looked up the official WhatsApp Business API but I am not sure that they will not approve my number as it is just a hobby project and not a proper "business".

There is an alternative though and that is the Twilio WhatsApp API. However, they provide you with a sandbox. I can interact with it in DMs but as the sandbox number is a business account, I cannot add it to a group like discord.

I intend to write a server in python or node.

Can anyone share a solution or workaround? Only if I could add the Twilio number to a group my problem will be solved. Though I am ready to use any other API/Solutions for this.