adwords api is not supported with video campaigns.Through templateAd we can create video ad.but it is also not supporting with video campaigns in adwords api. getting error while creating video ad.
No handlers could be found for logger "googleads.soap"
Traceback (most recent call last):
File "test_videoAdd.py", line 105, in <module>
main(adwords_client, 62216880120)
File "test_videoAdd.py", line 86, in main
ads = ad_group_ad_service.mutate(operations)
File "/home/sys1010/.local/lib/python2.7/site-packages/googleads/common.py", line 1391, in MakeSoapRequest
e.detail, errors=error_list, message=e.message)
googleads.errors.GoogleAdsServerFault: [OperationAccessDenied.MUTATE_ACTION_NOT_PERMITTED_FOR_CLIENT # operations[0]]
My code is
import urllib2
from googleads import adwords
AD_GROUP_ID = '62216880120'
def main(client, ad_group_id):
# Initialize appropriate service.
ad_group_ad_service = client.GetService('AdGroupAdService', version='v201806')
video = {
'xsi_type': 'Video',
'youTubeVideoIdString': "https://www.youtube.com/watch?v=CRTlNFPQCHk",
'type': 'VIDEO'
}
ad_data = {
'uniqueName': 'adData',
'fields': [
{
'name': 'video',
'fieldMedia': video,
'type': 'VIDEO'
}
]
}
video_ad = {
'xsi_type': 'TemplateAd',
'name': 'Ad for video',
'templateId': 49,
'finalUrls': ['https://www.google.com'],
'displayUrl': 'www.google.com?tip=ENTER_YOUR_OWN_FINAL_AND_DISPLAY_URLS',
'dimensions': {
'width': '300',
'height': '250'
},
'templateElements': [ad_data]
}
ad_group_ad = {
'adGroupId': ad_group_id,
'ad': video_ad,
'status': 'PAUSED'
}
operations = [
{
'operator': 'ADD',
'operand': ad_group_ad
}
]
ads = ad_group_ad_service.mutate(operations)
can somebody help me out of this error.Is there any libraries to create video campaigns programatically.
Related
I have updated Youtube video by using Youtube data api.I got successful response from api. I have updated my video title and also added cards with api. I can see title was updated instantly but not able to find added cards on Youtube video.
I have tried below given code with node.js api.I have not received any errors and api call was success. But video title was updated successfully from same api and cards are not visible on video
async function addInfoCardsToVideo(videoId) {
try {
// First, retrieve the video's current metadata
const video = await youtube.videos.list({
part: 'snippet',
id: 'myexistingvideoid', // This is my existing Youtube video id
});
// Next, construct the new metadata object with the info card data
const infoCard = {
kind: 'youtube#video',
videoId: videoId,
card: {
teaser: {
startTimeMs: 10000, // The time in milliseconds where the teaser begins
endTimeMs: 30000, // The time in milliseconds where the teaser ends
},
cards: [
{
teaserTitle: 'Info Card Title',
teaserDurationMs: 5000, // The duration of the teaser in milliseconds
teaserStartTimeMs: 20000, // The time in milliseconds where the teaser should be displayed
type: 'video',
videoId: 'othervideoid', // The video ID for the video you want to link to
},
],
},
};
// Update the video's metadata to add the info card
const update = await youtube.videos.update({
part: 'snippet',
resource: {
id: videoId,
snippet: {
...video.data.items[0].snippet,
localized: {
...video.data.items[0].snippet.localized,
},
cards: infoCard,
title:'updated video title'
},
},
});
console.log(`Successfully updated video: ${videoId}`);
} catch (err) {
console.error(`Error updating video: ${err}`);
}
}
addInfoCardsToVideo('myexistingvideoid') //passing my existing Youtube video id ]
Kindly help
I am using python Jira package and trying to create Jira issue:
from jira import JIRA
jiraOptions = {'server': "http://jira.xxx.com"}
jira = JIRA(options = jiraOptions, basic_auth=(
"xxx", "xxx"))
def create_new_issue(project, summary, description, issuetype, username):
issue_dict = {
'project': {'key': project},
'summary': summary,
'description': description,
'issuetype': {'name': issuetype},
'reporter': {'name': username}
}
new_issue = jira.create_issue(fields=issue_dict)
create_new_issue("p1", "test", "teseset", "Bug", "xxxx")
I get 405 error which I can't figure out where I got wrong:
Traceback (most recent call last):
File ".\jiraUtil.py", line 97, in <module>
create_new_issue("p1", "test", "teseset", "Bug", "xxxx")
File ".\jiraUtil.py", line 58, in create_new_issue
new_issue = jira.create_issue(fields=issue_dict)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\jira\client.py", line 1473, in create_issue
r = self._session.post(url, data=json.dumps(data))
File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\jira\resilientsession.py", line 198, in post
return self.__verb("POST", str(url), data=data, json=json, **kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\jira\resilientsession.py", line 189, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\jira\resilientsession.py", line 64, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 405 url: https://jira.xxx.com/rest/api/2/issue
At a guess, "xxxx" user doesn't exist in your Jira Cloud instance, try changing it to "-1" which is unassigned.
I ran into some issues myself doing this, so I built this project - https://github.com/dren79/JiraScripting_public let me know if it helps :)
I am using googleads API to perform the following operations:
- (1) upload new conversions
- (2) adjust uploaded conversions
The first operation could be done successfuly.
However the second opeartion which is the adjustment of the uploaded conversion is giving the error "INVALID_CONVERSION_TYPE".
According to the documentation in https://developers.google.com/adwords/api/docs/reference/v201809/OfflineConversionFeedService.OfflineConversionError#reason.
The reason for this error is that the conversion name does not match any uploaded conversion for the same customer,
although i have uploaded the conversion with the same conversion name for the same customer.
I am posting my request and the response i am receiving:
request=[{
'operator': 'ADD',
'operand':
{
'adjustmentTime': '20190802 235959 Etc/GMT',
'googleClickId': 'gcliID',
'adjustedValueCurrencyCode': 'EUR',
'conversionName': 'YY',
'adjustedValue': xx,
'xsi_type': 'GclidOfflineConversionAdjustmentFeed',
'conversionTime': '20190731 235959 Etc/GMT',
'adjustmentType': 'RESTATE'
}
}
]
response = {
'ListReturnValue.Type': 'OfflineConversionAdjustmentFeedReturnValue',
'value': [
{
'conversionName': None,
'adjustmentTime': None,
'adjustmentType': None,
'adjustedValue': None,
'adjustedValueCurrencyCode': None,
'OfflineConversionAdjustmentFeed.Type': 'GclidOfflineConversionAdjustmentFeed',
'googleClickId': None,
'conversionTime': None
}
],
'partialFailureErrors': [
{
'fieldPath': 'operations[0].operand.conversionName',
'fieldPathElements': [
{
'field': 'operations',
'index': 0L
},
{
'field': 'operand',
'index': None
},
{
'field': 'conversionName',
'index': None
}
],
'trigger': None,
'errorString': 'OfflineConversionAdjustmentError.INVALID_CONVERSION_TYPE',
'ApiError.Type': 'OfflineConversionAdjustmentError',
'reason': 'INVALID_CONVERSION_TYPE'
}
]
}
Have you ever solved this issue? I'm having the very same one. The only solution I could find is not to use gclid, but switched to orderId - now adjustment works for me.
I have a page where users can paste a Youtube video url and then I need to extract the video's ID in order to get the video's thumbnail image. The hard part is to get a reliable way of extracting the video ID from the video url. There are a number of regex solutions here but for me none of these are 100% reliable. Here's a few:
JavaScript REGEX: How do I get the YouTube video id from a URL?
Youtube API - Extract video ID
It's like a contest of who has a longer regex. I feel like the right way would be to get this information from Youtube's api, but looking at it, seems like this option is not available:
https://developers.google.com/apis-explorer/#p/youtube/v3/
As you can see everything is based on the video id. I find it ridiculous that I need the actual video ID to get any information about the video since no real world user will ever even know what the video id is. Vimeo has this feature built into their API. Here is an example:
https://vimeo.com/api/oembed.json?url=https://vimeo.com/29474908
Does anyone have a solution for this that does not involve some regular expression?
Doing a search with the API works with different YouTube URL types. The URL is passed as the query term q.
https://www.googleapis.com/youtube/v3/search/?key=<YOUR_KEY>&part=snippet&q=youtu.be/M7lc1UVf-VE
Maybe some case could result in more than one item, but the normal search result is just one match:
{
kind: "youtube#searchListResponse",
etag: ""m2yskBQFythfE4irbTIeOgYYfBU/j2Px-5q--mgJEsrfjg4L0Mgn_L8"",
regionCode: "ES",
pageInfo: {
totalResults: 1,
resultsPerPage: 5
},
items: [
{
kind: "youtube#searchResult",
etag: ""m2yskBQFythfE4irbTIeOgYYfBU/_1gFVi_i_djlS4OZWPGtcZ3iSLQ"",
id: {
kind: "youtube#video",
videoId: "M7lc1UVf-VE"
},
snippet: {
publishedAt: "2013-04-10T17:25:04.000Z",
channelId: "UC_x5XG1OV2P6uZZ5FSM9Ttw",
title: "YouTube Developers Live: Embedded Web Player Customization",
description: "On this week's show, Jeff Posnick covers everything you need to know about using player parameters to customize the YouTube iframe-embedded player.",
thumbnails: {
default: {
url: "https://i.ytimg.com/vi/M7lc1UVf-VE/default.jpg",
width: 120,
height: 90
},
medium: {
url: "https://i.ytimg.com/vi/M7lc1UVf-VE/mqdefault.jpg",
width: 320,
height: 180
},
high: {
url: "https://i.ytimg.com/vi/M7lc1UVf-VE/hqdefault.jpg",
width: 480,
height: 360
}
},
channelTitle: "Google Developers",
liveBroadcastContent: "none"
}
}
]
}
I tested with some of the URL variations from this answer and most worked:
var urls = [
'//www.youtube-nocookie.com/embed/M7lc1UVf-VE?rel=0',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&feature=channel',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&playnext_from=TL&videos=osPknwzXEas&feature=sub',
'https://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I', // <---- invalid
'https://youtu.be/M7lc1UVf-VE',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&feature=youtu.be',
'https://youtu.be/M7lc1UVf-VE',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&feature=channel',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&playnext_from=TL&videos=osPknwzXEas&feature=sub',
'https://www.youtube.com/ytscreeningroom?v=M7lc1UVf-VE', // <---- invalid
'https://www.youtube.com/embed/M7lc1UVf-VE?rel=0',
'https://www.youtube.com/watch?v=M7lc1UVf-VE',
'https://youtube.com/v/M7lc1UVf-VE?feature=youtube_gdata_player',
'https://youtube.com/vi/M7lc1UVf-VE?feature=youtube_gdata_player', // <---- invalid
'https://youtube.com/?v=M7lc1UVf-VE&feature=youtube_gdata_player',
'https://www.youtube.com/watch?v=M7lc1UVf-VE&feature=youtube_gdata_player',
'https://youtube.com/?vi=M7lc1UVf-VE&feature=youtube_gdata_player', // <---- invalid
'https://youtube.com/watch?v=M7lc1UVf-VE&feature=youtube_gdata_player',
'https://youtube.com/watch?vi=M7lc1UVf-VE&feature=youtube_gdata_player',
'https://youtu.be/M7lc1UVf-VE?feature=youtube_gdata_player'
];
var my_key = '<YOUR_KEY>';
function getUri(uri){
$.get('https://www.googleapis.com/youtube/v3/search/?key='+my_key+'&part=snippet&q='+uri, function(data) {
if(data.items.length !== 0)
console.log(data.items[0].snippet.publishedAt);
else
console.warn('no items for',uri)
});
}
for (i = 0; i < urls.length; ++i) {
getUri(urls[i]);
}
I have installed django-pyodbc and configured my database settings as:
DEV: Windows XP (64bit), Python 3.3, MDAC 2.7
DB: Remote MSSQL 2008
DATABASES = {
'default': {
'ENGINE': 'django_pyodbc',
'HOST': 'my.server.com',
'PORT': '14330',
'USER': 'xxx500',
'PASSWORD': 'passw',
'NAME': 'xxx500',
'OPTIONS': {
'host_is_server': True
},
}
}
I can telnet to the server and I can access the database via 3rd party GUI Aqua Data Studio - so I know there is no firewall issue of login issue
When I try to run this command to introspect the legacy database I get this error...
(myProject) :\Users\...>python manage.py inspectdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python33\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python33\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python33\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python33\lib\site-packages\django\core\management\base.py", line 285, in execute
output = self.handle(*args, **options)
File "C:\Python33\lib\site-packages\django\core\management\base.py", line 415, in handle
return self.handle_noargs(**options)
File "C:\Python33\lib\site-packages\django\core\management\commands\inspectdb.py", line 27, in handle_noargs
for line in self.handle_inspection(options):
File "C:\Python33\lib\site-packages\django\core\management\commands\inspectdb.py", line 40, in handle_inspection
cursor = connection.cursor()
File "C:\Python33\lib\site-packages\django\db\backends\__init__.py", line 157, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python33\lib\site-packages\django_pyodbc\base.py", line 280, in _cursor
autocommit=autocommit)
pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect)')
What am I missing? Would appreciate some feedback.
Thanks
I made the following changes:
From
DATABASES = {
'default': {
'ENGINE': 'django_pyodbc',
'HOST': 'my.server.com',
'PORT': '14330',
'USER': 'xxx500',
'PASSWORD': 'passw',
'NAME': 'xxx500',
'OPTIONS': {
'host_is_server': True
},
}
}
To
DATABASES = {
'default': {
...
'HOST': 'my.server.com,14330',
...
}
}
and got the utf-8 error that requires commenting out lines 364-367 in the django_pyodbc/base.py file.
I believe that isn't really the solution you'd like to use; modifying the code of django-pyodbc isn't a good idea. That said, be sure you're using the most current fork of django-pyodbc, which can currently be found here:
https://github.com/lionheart/django-pyodbc/
Here's an example DB configuration for settings.py which I've gotten to work on the following platforms (w/FreeTDS / UnixODBC for Linux):
Windows 7
Ubuntu as a VM under Vagrant
Mac OS/X for local development
RHEL 5 + 6
Here's the configuration:
DATABASES = {
'default': {
'ENGINE': 'django_pyodbc',
'NAME': 'db_name',
'USER': 'db_user',
'PASSWORD': 'your_password',
'HOST': 'database.domain.com,1433',
'PORT': '1433',
'OPTIONS': {
'host_is_server': True,
'autocommit': True,
'unicode_results': True,
'extra_params': 'tds_version=8.0'
},
}
}
You need to add the driver to your database back end.
DATABASES = {
'default': {
.......
'OPTIONS': {
.......
'driver' : 'SQL Server',
.......
},
}
}
String. ODBC Driver to use. Default is "SQL Server" on Windows and "FreeTDS" on other platforms.