What's the best way to escape user input for use in GAQL queries when 
searching with the GoogleAdsService with the Python client library?

For example:

search = "Something from user input"
query = f"SELECT campaign.id FROM campaign WHERE campaign.name LIKE 
'%{search}%'"
google_ads_service.search(customer_id='XXXYYYZZZZ', query=query)

If the user enters quote or backslash characters, the query breaks

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6261224a-9c8b-47c4-a859-1d2ccd1f1840n%40googlegroups.com.

Reply via email to