Coder Social home page Coder Social logo

line-item-manager's People

Contributors

dlackty avatar dshore avatar jaesbit avatar martinsvoboda avatar milesmahon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

line-item-manager's Issues

WARNING:googleads.common:Your default encoding, cp1252, is not UTF-8. Please run this script with UTF-8 encoding to avoid errors.

  • line-item-manager version: 0.2.3
  • Python version: 3.9
  • Operating System: Windows 10 Pro

Description

I'm trying to create line items with adunits but line item manager warns me with this message.
WARNING:googleads.common:Your default encoding, cp1252, is not UTF-8. Please run this script with UTF-8 encoding to avoid errors.

I found that my adunit names contains Turkish characters like "mysite_Desktop_İçerikArası_Top" and warning comes from googleads sdk but there is no way to change default encoding to UTF-8.

I think it will be fixed if you guys use UTF-8 as default encoding. I've also searched codes abut couldn't find where should I add this.

What I Did

My execution command is;
line_item_manager create mysite.yml -b criteo -k "Avva Mobile - Header Bidding - Service Account.json" --dry-run

Multiple creatives

  • line-item-manager version: 0.1.14

Question

How do i create multiple banner creatives to each line item?

Support for advertisers of different types

Description

I would like to be able to create orders based on Companies of types other than ADVERTISER, e.g. AD_NETWORK.

AC

Add support for the following config changes:

advertiser: # at least one of the following types is required {id, name}
  name: "Prebid"
  # id: 1234567890
  # type: "AD_NETWORK" # optional: defaults to "ADVERTISER"

show bidders results in SSL error

  • line-item-manager version: 0.2.3
  • Python version: Python 3.7.3
  • Operating System: macOS 11.4 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64

Description

I was trying to get a list of bidders and got an SSL error.

What I Did

(py3.7) ➜  orders line_item_manager show bidders
Code                     Name
----                     ----
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/eugene/.virtualenvs/py3.7/bin/line_item_manager", line 8, in <module>
    sys.exit(main())
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/line_item_manager/cli.py", line 169, in main
    cli() # pylint: disable=no-value-for-parameter
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/line_item_manager/cli.py", line 165, in show
    for row in sorted(prebid.bidders.values(), key=lambda x: x['bidder-code']):
  File "/Users/eugene/.virtualenvs/py3.7/lib/python3.7/site-packages/line_item_manager/prebid.py", line 26, in bidders
    request.urlopen(BIDDERS['data']).readlines()])
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

Creatives created should have 1x1 Target ad unit size and size overrides with the actual sizes

  • line-item-manager version: 0.1.8

Description

Referring to documentation here - or here, Prebid recommends creating creatives of target ad size 1x1 and having size overrides for all the sizes in each 1x1 creative.

Prebid creatives being size agnostic, the same creatives can be used for any bid and any size that has hit the line item. This is especially useful when more than 1 bid from the page for the same size ends up hitting the same line item. GAM does not have the ability to serve the same creative twice for one size, so it will just ignore all the requests beyond the first one if they are all for the same size.

What the tool currently creates

image

What the tool should do

image

Also, the number of 1x1 creatives should be equal to the number of sizes that the line items cater to, with a max limit of five.

So if the user wants to create line items for five sizes, there should be five 1x1 creatives each with ALL five sizes in the size overrides field.

If the user wants to create line items for seven sizes, there should still be five 1x1 creatives each with ALL seven sizes in the size overrides field.

Certain currency values are invalid

Description

I configured a custom granularity with a minimum of 4.51

What I Did

rate:
  currency: "USD" # required
  granularity:
    type: "custom" # required, choices: "low", "med", "high", "auto", "dense", "custom"
    custom:
      - min: 4.51
        max: 50.00
        interval: 0.01

What happened

Error: Check your configfile for the following validation errors:
  - Path(rate, granularity, custom, 0, min): 4.51 is not a multiple of 0.01

Trying to make hb_pb custom key as the CPM

  • line-item-manager version: 0.2.1
  • Python version: 3.9
  • Operating System: macOS

Description

I'm doing a hybrid of single order and send all bids, to cut down on the amount of key-values in my GPT and keep reporting at the advertiser/order/line item level.
My line item targeting for example in GAM:
placement=("Placement name") AND custom=("hb_bidder=ix AND hb_pb=0.01")

What I Did

Here is the error I receive.
ERROR:line_item_manager.cli:Google Ads Error, [CustomTargetingError.KEY_NAME_INVALID_CHARS @ name; trigger:'<"{{ cpm }}">']

Basically I want to see if i can use the cpm of the line as a key-value.

config.txt

Paste the command(s) you ran and the output.  And if relevant, attach your YAML config file.
If there was a crash, please include the traceback here.

Support Team ID

  • line-item-manager version: all
  • Python version: any
  • Operating System: any

Description

Customers who use the premium version of GAM can utilize the "teams" feature. When that happens, Orders must be created with the "appliedTeamIds" field listing which teams have access to that order.

If the service account has a team, then the orders must be created with that appliedTeamId or the order won't run.

Proposal: support an optional "appliedTeamIds" field in the YAML file. e.g.

###############################################################################
# Orders (required)
# Allowed Templating Key Words: Bidder, Media, Order, Misc
###############################################################################
order:
  name: "Prebid-{{ bidder_name }}-{{ media_type }}-{{ time }} {{ cpm_min }}-{{ cpm_max }}"
  appliedTeamIds: 
     - 101
     - 555
     - 234567

(Note: my YAML is sketchy - whatever's the best way to represent an array of long ints)

If specified, add the appliedTeamIds argument to the Orders request made to the GAM API.

SafeFrame property in YAML being ignored by GAM

  • line-item-manager version: 0.2.9
  • Python version: 3.9
  • Operating System: macOS Monterey, 12.6

Description

I'm trying to create line items with creatives that do not serve in a SafeFrame. I'm setting the safe_frame under creative > banner to false. When I do a test run, the creatives that are created still have "Serve into a SafeFrame" checked off.

What I Did

I ran this command with the attached YAML file: line_item_manager create txmo_config-updated.yml -b teads -t

YAML File

GAM Screenshot

Video Creative Duration set to 1000ms

  • line-item-manager version: all
  • Python version: all
  • Operating System: all

Description:

Prebid documentation states creative video duration should be 1 second:
https://docs.prebid.org/adops/setting-up-prebid-video-in-dfp.html

Currently we are setting duration to 60ms:
https://github.com/prebid/line-item-manager/blob/master/line_item_manager/operations.py#L117

In GAM UI duration is in seconds, so 60ms appears as zero seconds, which can be confusing to people reviewing the video creative.

Acceptance Criteria

  1. Video creative has duration of 1 second (1000 milliseconds using the API)
  2. GAM UI shows "1" in the duration field for the video creative.

AttributeError: 'datetime.timezone' object has no attribute 'zone'

  • line-item-manager version: 0.2.2
  • Python version: 3.8.3
  • Operating System: Mac OS 11.3

Description

Failed attempt to create line items on GAM using line-item-manager

What I Did

When I used the --dry-run flag, it was successful.

line_item_manager create <yml config file> --dry-run --private-key-file <privatekey.json> --bidder-code appnexus

But when I removed the flag

line_item_manager create <yml config file> --private-key-file <privatekey.json> --bidder-code appnexus

I encountered this error message:
line 413, in AdManagerDateTimePacker 'timeZoneId': value.tzinfo.zone,
AttributeError: 'datetime.timezone' object has no attribute 'zone'

config file:
demo_line_item_manager.yml.zip

error trace:
error.log

Error for unsupported GAM API version is not handled properly

Description

See issue #113 which is older versions of tool are pegged to deprecated GAM API versions and the error message is not helpful.

AC

  1. Error message correctly states that the GAM API version is not supported.
  2. Upgrade pypi googleads version as this is outdated and related.

Support use of a custom line-item template instead of package default

Description

On occasions that require additional attribute detailing on the line item it would be nice to be able to specify a custom template.

Example use case of adding geoTargeting by modifying the line item template since it is not supported in the configuration; one could add the below as a custom template:

. . .

targeting:
  geoTargeting:
    excludedLocations:
      - id: 2840
        displayName: "United States"

. . .

AC

Add a CLI option to specify a custom line item template to use instead of the package default. E.g:

$ line_item_manager show template > exclude_US_template.yml
# edit exclude_US_template.yml adding above targeting to exclude the United States
$ line_item_manager create my_config.yml --single-order --template exclude_US_template.yml

Bidder Targeting Key status is 'INACTIVE'

  • line-item-manager version: all
  • Python version: all
  • Operating System: all

Description

Create line items when bidder targeting key status is 'inactive' results in an error.

What I Did

line_item_manager create <config.yml> -b <bidder-code>

Test orders not auto-archived

  • line-item-manager version: 0.1.13
  • Python version: all
  • Operating System: all

Description

Creation with --test-run does not auto-archive orders as documented.

What I Did

line_item_manager create jw.yml -b pubmatic -t

Then went to Google Ad Manager, searched for newly created orders and they were not auto-archived.

VAST URL should reference the 'uuid' targeting key in default template config

  • line-item-manager version: all
  • Python version: all
  • Operating System: all

Description:

Prebid documentation states VAST URL should reference the 'uuid' targeting key:
https://docs.prebid.org/adops/setting-up-prebid-video-in-dfp.html

Currently we are referencing the 'cache' targeting key in the default configuration:
https://github.com/prebid/line-item-manager/blob/master/line_item_manager/conf.d/line_item_manager.yml#L76

Acceptance Criteria

  1. Update the default VAST URL to use the 'uuid' targeting key.

Creative duration default to 30 seconds OR user specified

Description

According to official Prebid documentation on setting up video in GAM, the recommended ad duration should be set to max duration.

See: https://docs.prebid.org/adops/setting-up-prebid-video-in-dfp.html#creative-setup

Additionally it would be user friendly to allow an override of duration in creative block in config.

AC

Per Prebid documentation implement the following:

  • default creative duration to match max duration (that is currently 30000 milliseconds)
  • support config duration in creative block

Support reportableType settings for CustomTargetingKey

Description

I would like to be able to control the reportableType for custom targeting keys to include values in reporting.

AC

The configuration template includes attributes for setting the reportableType for both bidder and custom targeting keys.

Add native line item support

Description

It would be great to have native line item setup functionality.

Based on the official prebid docs, the line-item part mainly differs in the custom creative format, so I assume steps done by the tool would be:

  1. Request* a custom creative format ID (e.g. YAML input).

  2. Define the NativeStyle, as in GAM example;

  3. Instantiate a new creative from format/template ID

  4. Move with line-item setup, specifying this new format in expected creatives & attaching the new creative to the line-item.

*Note that GAM API docs doesn't seem to have any methods for creating it, so I guess it's either using one of the standard IDs (10004400 or 10004520) along with the mandatory macros, or requesting the ID from the user; It's also worth mentioning that, if there is already a NativeStyle in place for said ID, it would be necessary to include labels to specify where it would be delivered.

What do you guys think?

If you guys have any/questions considerations, please let me know!

Creative for Bidder specific line items needs the biddercode in the pattern match macro replaced by actual bidder code

  • line-item-manager version: 0.1.8

Description

When creating a bidder based set of line items, the creative used is this:
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script> <script> var ucTagData = {}; ucTagData.adServerDomain = ""; ucTagData.pubUrl = "%%PATTERN:url%%"; ucTagData.adId = "%%PATTERN:hb_adid_BIDDERCODE%%"; ucTagData.cacheHost = "%%PATTERN:hb_cache_host_BIDDERCODE%%"; ucTagData.cachePath = "%%PATTERN:hb_cache_path_BIDDERCODE%%"; ucTagData.uuid = "%%PATTERN:hb_cache_id_BIDDERCODE%%"; ucTagData.mediaType = "%%PATTERN:hb_format_BIDDERCODE%%"; ucTagData.env = "%%PATTERN:hb_env%%"; ucTagData.size = "%%PATTERN:hb_size_BIDDERCODE%%"; ucTagData.hbPb = "%%PATTERN:hb_pb_BIDDERCODE%%"; // mobileResize needed for mobile GAM only ucTagData.mobileResize = "hb_size:%%PATTERN:hb_size_BIDDERCODE%%"; try { ucTag.renderAd(document, ucTagData); } catch (e) { console.log(e); } </script>

The BIDDERCODE in the above code should be replaced by the actual bidder specified when running the command with the -b modifier.

Here's what the tool creates

image

Here's what the tool should create

image

NOTE: GAM has an upper limit of 20 characters for each key you send to it. For some bidders the entire key including the hb_pb_ or hb_cache_host_, may exceed the 20 char limit, so it should correctly truncate the length.

For example, if we choose bidder rubicon it would be hb_cache_host_rubico

Resume interrupted operation of line items creation

  • line-item-manager version: 0.2.3
  • Python version: 3.9.7
  • Operating System: Red Hat

I am wondering if line item manager is supposed to resume line items creation, or should I always start from the scratch when the process got interrupted.

As far as I see it can detect presense of advertiser, creatives and orders, and it is logical for the line itme manager to also see that line items already exist in the order (they have the same name), but instead it fails with UniqueError.NOT_UNIQUE . My name template for line items is Prebid @{{cpm}}.
Since I do 450 line items per order, it also fails with EntityChildrenLimitReachedError.LINE_ITEM_LIMIT_FOR_ORDER_REACHED when I simly re-run the same command with a different name template.

Thanks.

Error during line item creative association

  • line-item-manager version: all
  • Python version: all
  • Operating System: all

Description

Creations of large numbers of line item creative associations (thousands) will result in unexpected errors during preparation, transmission and/or processing.

What I Did

Ran config from @frjohan which has 399 line items and 18 creatives for 7,182 associations.

INFO:line_item_manager.gam_config:################################################################################
INFO:line_item_manager.gam_config:Bidder: name="Top Bid", code="hb"
INFO:line_item_manager.gam_config:Key: "hb_pb", Values: ['1.00', '1.50', '2.00', ..., '199.00', '199.50', '200.00']
INFO:line_item_manager.gam_config:############################################################
INFO:line_item_manager.gam_config:Media Type: "banner"
INFO:line_item_manager.gam_config:Line Items: CPMs(min=1.00, max=200.00, cnt=399)
INFO:line_item_manager.gam_config:Line Item Creative Associations: Creative Count=18
INFO:line_item_manager.gam_config:Auto-archiving Orders:
[2816257110]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/googleads/common.py", line 991, in MakeSoapRequest
    return soap_service_method(
  File "/usr/local/lib/python3.8/site-packages/zeep/proxy.py", line 46, in __call__
    return self._proxy._binding.send(
  File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 135, in send
    return self.process_reply(client, operation_obj, response)
  File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply
    return self.process_error(doc, operation)
  File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 317, in process_error
    raise Fault(
zeep.exceptions.Fault: Unknown fault occured

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/line_item_manager", line 33, in <module>
    sys.exit(load_entry_point('line-item-manager', 'console_scripts', 'line_item_manager')())
  File "/home/app/line_item_manager/cli.py", line 160, in main
    cli() # pylint: disable=no-value-for-parameter
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/app/line_item_manager/cli.py", line 128, in create
    gam.create_line_items()
  File "/home/app/line_item_manager/gam_config.py", line 228, in create_line_items
    self._lica_objs.append(li_.create())
  File "/home/app/line_item_manager/gam_config.py", line 78, in create
    return LICA().create(recs, validate=True)
  File "/home/app/line_item_manager/gam_operations.py", line 41, in create
    getattr(self.svc(), self.create_method)(atts)
  File "/usr/local/lib/python3.8/site-packages/googleads/common.py", line 996, in MakeSoapRequest
    underlying_exception = e.detail.find(
TypeError: argument should be integer or bytes-like object, not 'str'

Video: Implement size override

Description

Currently size overrides for creatives is only implemented for banner.

AC

Size override is implemented for video with the following requirements:

  • default is False
  • creative is 1x1

Error: Check your network code and permissions. Not able to successfully access your service account

  • line-item-manager version:0.2.5
  • Python version:pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
  • Operating System:CentOS Linux release 7.9.2009 (Core)

Description

After configuring a new YML, we were testing with --dry-run to make sure all was ok.
but we keep getting the error:
Error: Check your network code and permissions. Not able to successfully access your service account

Note:We use the same json key file for multiple AdsManager API (reporting for example) all is working correctly.

What I Did

line_item_manager create AdPone_config.yml -v --dry-run --private-key-file 57a4e902aa62.json --network-code XXXXXXXX --network-name XXXXXXXX--bidder-code adpone

AdPone_config.zip

we have used line-item-manager half a dozen times, always working perfectly. last time was in may. no issues.
cant figure out what has changed since that could give this authentication error.

Unavailable certificate when reading prebid bidder-data.csv

Description

Some users may get the following when code tries to access the bidder-data.csv file:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Fix

Specify trusted CA certificates:

import certifi
import ssl
from urllib import request

context = ssl.create_default_context(cafile=certifi.where())

_x = [l.decode('utf-8') for l in \
      request.urlopen('https://docs.prebid.org/dev-docs/bidder-data.csv',
                      context=context).readlines()]

Custom targeting of "CustomKey1 != True AND CustomKey2 != True"

  • line-item-manager version:
  • Python version:
  • Operating System:

Background

For custom targeting the following is implemented:

Answer

Therefore to implement: "CustomKey1 != True AND CustomKey2 != True" this seems logically correct:

targeting:
  custom: # list (optional)
    - name: "CustomKey1"
      values:
        - "False"
    - name: "CustomKey2"
      values:
        - "False"

Enhancement:

The following which is not currently supported but could be added as a feature:

targeting:
  custom: # list (optional)
    - name: "CustomKey1"
      operator: "IS_NOT"
      values:
        - "True"
    - name: "CustomKey2"
      operator: "IS_NOT"
      values:
        - "True"

Targeting by placement_names returns error "Placement was not found "

  • line-item-manager version: 0.2.3
  • Python version: 3.9.4
  • Operating System: 10.0.19042 Build 19042

Description

Trying to push line items with targeting specific placement_names.

The placement does exist and the name is copy-pasted to avoid typos, however, i keep getting this:

ERROR:line_item_manager.cli:Not able to find the following resource:

  • Placement named 'Prebid Inventory' was not found

NOTE: tried other placement names too

What I Did

###############################################################################
targeting:
  bidder: # object (optional)
    reportableType: "ON" # optional, defaults to "OFF", choices: "ON", "OFF", "CUSTOM_DIMENSION"
  # custom: # list (optional)
    # - name: "country"
      # operator: "IS_NOT" # optional: defaults to "IS"
      # values:
        # - "US"
        # - "CAN"
      # reportableType: "ON" # optional, defaults to "OFF", choices: "ON", "OFF", "CUSTOM_DIMENSION"
    # - name: "site"
      # operator: "IS_NOT" # optional: defaults to "IS"
      # values:
        # - "somesite"
      # reportableType: "ON" # optional, defaults to "OFF", choices: "ON", "OFF", "CUSTOM_DIMENSION"
  placement_names: # list of names (optional)
    - "Prebid Inventory"
#     - "placement name 2"
#   ad_unit_names: # list of names (optional)
#     - "ad unit name 1"
#     - "ad unit name 2"
###############################################################################


ssl.SSLEOFError: EOF occurred in violation of protocol

  • line-item-manager version: 0.2.9
  • Python version: 3.8.9
  • Operating System: Ubuntu 16.04.7

Description

I sometimes get the error below with configurations which take a long time (3-5 hours, 5k line items). I assume the longer it runs, the higher the chance the error will occur.

I did run the same configuration on some other GAM, and it didn't error out.

Is there any way to prevent this or recover from it (to continue form where it failed)?

Similiar to #25

What I Did

INFO:line_item_manager.gam_config:Line Item Creative Associations: Writing 12600 records...
   32%|█████████████████████████████████████████████████████                                                                                                                  | 4000/12600 [08:33<18:24,  7.79it/s]INFO:line_item_manager.gam_config:Auto-archiving Orders:
[..., ..., ..., ..., ..., ...]
WARNING:googleads.soap:Error summary: {'faultMessage': '[ServerError.SERVER_ERROR @ ]', 'requestId': '...', 'responseTime': '25216', 'serviceName': 'OrderService', 'methodName': 'performOrderAction'}
ERROR:line_item_manager.cli:Cleanup: Google Ads Error, [ServerError.SERVER_ERROR @ ]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1125)

bidder-data.csv has spaces, causing line-item-manager to not find line items

  • line-item-manager version: 0.2.9
  • Python version: 3.11
  • Operating System: Mac 13.3.1 (Ventura)

Description

On Aug 8, I ran line-item-manager to create orders for a handful of bidders. On Aug 9, when trying to continue with other SSPs, I started to run into an issue where I would receive error output stating "Following items were not found after creation" with a list of line item names that are prepended with whitespace (a single space), and I'm only now getting around to having a look at why this is happening.

What I Did

Here is a sample of the command run (network-code removed for privacy):

python % line_item_manager create ./lineitemmanager/gumgum_8.01-10.99.yaml -k gam_creds_james.json -b gumgum --network-code [NETWORK_CODE_REMOVED] --network-name="Test GAM Account" INFO:line_item_manager.gam_config:################################################################################ INFO:line_item_manager.gam_config:Bidder: name=" GumGum", code="gumgum" INFO:line_item_manager.gam_config:Key: "hb_pb_gumgum", Values: ['8.01', '8.02', '8.03', ..., '10.97', '10.98', '10.99'] INFO:line_item_manager.gam_config:############################################################ INFO:line_item_manager.gam_config:Media Type: "banner" INFO:line_item_manager.gam_config:Line Items: CPMs(min=8.01, max=10.99, count=299) INFO:line_item_manager.gam_config:Line Item Creative Associations: Creative Count=13 ERROR:line_item_manager.cli:Unexpected result, Following items were not found after creation: '[' GumGum: HB $8.01', ' GumGum: HB $8.02', ' GumGum: HB $8.03', ' GumGum: HB $8.04', ' GumGum: HB $8.05', ' GumGum: HB $8.06', ' GumGum: HB $8.07', ' GumGum: HB $8.08', ' GumGum: HB $8.09', ' GumGum: HB $8.10', ' GumGum: HB $8.11', ' GumGum: HB $8.12', ' GumGum: HB $8.13', ' GumGum: HB $8.14', ' GumGum: HB $8.15', ' GumGum: HB $8.16', ' GumGum: HB $8.17', ' GumGum: HB $8.18', ' GumGum: HB $8.19', ' GumGum: HB $8.20', ' GumGum: HB $8.21', ' GumGum: HB $8.22', ' GumGum: HB $8.23', ' GumGum: HB $8.24', ' GumGum: HB $8.25', ' GumGum: HB $8.26', ' GumGum: HB $8.27', ' GumGum: HB $8.28', ' GumGum: HB $8.29', ' GumGum: HB $8.30', ' GumGum: HB $8.31', ' GumGum: HB $8.32', ' GumGum: HB $8.33', ' GumGum: HB $8.34', ' GumGum: HB $8.35', ' GumGum: HB $8.36', ' GumGum: HB $8.37', ' GumGum: HB $8.38', ' GumGum: HB $8.39', ' GumGum: HB $8.40', ' GumGum: HB $8.41', ' GumGum: HB $8.42', ' GumGum: HB $8.43', ' GumGum: HB $8.44', ' GumGum: HB $8.45', ' GumGum: HB $8.46', ' GumGum: HB $8.47', ' GumGum: HB $8.48', ' GumGum: HB $8.49', ' GumGum: HB $8.50', ' GumGum: HB $8.51', ' GumGum: HB $8.52', ' GumGum: HB $8.53', ' GumGum: HB $8.54', ' GumGum: HB $8.55', ' GumGum: HB $8.56', ' GumGum: HB $8.57', ' GumGum: HB $8.58', ' GumGum: HB $8.59', ' GumGum: HB $8.60', ' GumGum: HB $8.61', ' GumGum: HB $8.62', ' GumGum: HB $8.63', ' GumGum: HB $8.64', ' GumGum: HB $8.65', ' GumGum: HB $8.66', ' GumGum: HB $8.67', ' GumGum: HB $8.68', ' GumGum: HB $8.69', ' GumGum: HB $8.70', ' GumGum: HB $8.71', ' GumGum: HB $8.72', ' GumGum: HB $8.73', ' GumGum: HB $8.74', ' GumGum: HB $8.75', ' GumGum: HB $8.76', ' GumGum: HB $8.77', ' GumGum: HB $8.78', ' GumGum: HB $8.79', ' GumGum: HB $8.80', ' GumGum: HB $8.81', ' GumGum: HB $8.82', ' GumGum: HB $8.83', ' GumGum: HB $8.84', ' GumGum: HB $8.85', ' GumGum: HB $8.86', ' GumGum: HB $8.87', ' GumGum: HB $8.88', ' GumGum: HB $8.89', ' GumGum: HB $8.90', ' GumGum: HB $8.91', ' GumGum: HB $8.92', ' GumGum: HB $8.93', ' GumGum: HB $8.94', ' GumGum: HB $8.95', ' GumGum: HB $8.96', ' GumGum: HB $8.97', ' GumGum: HB $8.98', ' GumGum: HB $8.99', ' GumGum: HB $9.00', ' GumGum: HB $9.01', ' GumGum: HB $9.02', ' GumGum: HB $9.03', ' GumGum: HB $9.04', ' GumGum: HB $9.05', ' GumGum: HB $9.06', ' GumGum: HB $9.07', ' GumGum: HB $9.08', ' GumGum: HB $9.09', ' GumGum: HB $9.10', ' GumGum: HB $9.11', ' GumGum: HB $9.12', ' GumGum: HB $9.13', ' GumGum: HB $9.14', ' GumGum: HB $9.15', ' GumGum: HB $9.16', ' GumGum: HB $9.17', ' GumGum: HB $9.18', ' GumGum: HB $9.19', ' GumGum: HB $9.20', ' GumGum: HB $9.21', ' GumGum: HB $9.22', ' GumGum: HB $9.23', ' GumGum: HB $9.24', ' GumGum: HB $9.25', ' GumGum: HB $9.26', ' GumGum: HB $9.27', ' GumGum: HB $9.28', ' GumGum: HB $9.29', ' GumGum: HB $9.30', ' GumGum: HB $9.31', ' GumGum: HB $9.32', ' GumGum: HB $9.33', ' GumGum: HB $9.34', ' GumGum: HB $9.35', ' GumGum: HB $9.36', ' GumGum: HB $9.37', ' GumGum: HB $9.38', ' GumGum: HB $9.39', ' GumGum: HB $9.40', ' GumGum: HB $9.41', ' GumGum: HB $9.42', ' GumGum: HB $9.43', ' GumGum: HB $9.44', ' GumGum: HB $9.45', ' GumGum: HB $9.46', ' GumGum: HB $9.47', ' GumGum: HB $9.48', ' GumGum: HB $9.49', ' GumGum: HB $9.50', ' GumGum: HB $9.51', ' GumGum: HB $9.52', ' GumGum: HB $9.53', ' GumGum: HB $9.54', ' GumGum: HB $9.55', ' GumGum: HB $9.56', ' GumGum: HB $9.57', ' GumGum: HB $9.58', ' GumGum: HB $9.59', ' GumGum: HB $9.60', ' GumGum: HB $9.61', ' GumGum: HB $9.62', ' GumGum: HB $9.63', ' GumGum: HB $9.64', ' GumGum: HB $9.65', ' GumGum: HB $9.66', ' GumGum: HB $9.67', ' GumGum: HB $9.68', ' GumGum: HB $9.69', ' GumGum: HB $9.70', ' GumGum: HB $9.71', ' GumGum: HB $9.72', ' GumGum: HB $9.73', ' GumGum: HB $9.74', ' GumGum: HB $9.75', ' GumGum: HB $9.76', ' GumGum: HB $9.77', ' GumGum: HB $9.78', ' GumGum: HB $9.79', ' GumGum: HB $9.80', ' GumGum: HB $9.81', ' GumGum: HB $9.82', ' GumGum: HB $9.83', ' GumGum: HB $9.84', ' GumGum: HB $9.85', ' GumGum: HB $9.86', ' GumGum: HB $9.87', ' GumGum: HB $9.88', ' GumGum: HB $9.89', ' GumGum: HB $9.90', ' GumGum: HB $9.91', ' GumGum: HB $9.92', ' GumGum: HB $9.93', ' GumGum: HB $9.94', ' GumGum: HB $9.95', ' GumGum: HB $9.96', ' GumGum: HB $9.97', ' GumGum: HB $9.98', ' GumGum: HB $9.99', ' GumGum: HB $10.00', ' GumGum: HB $10.01', ' GumGum: HB $10.02', ' GumGum: HB $10.03', ' GumGum: HB $10.04', ' GumGum: HB $10.05', ' GumGum: HB $10.06', ' GumGum: HB $10.07', ' GumGum: HB $10.08', ' GumGum: HB $10.09', ' GumGum: HB $10.10', ' GumGum: HB $10.11', ' GumGum: HB $10.12', ' GumGum: HB $10.13', ' GumGum: HB $10.14', ' GumGum: HB $10.15', ' GumGum: HB $10.16', ' GumGum: HB $10.17', ' GumGum: HB $10.18', ' GumGum: HB $10.19', ' GumGum: HB $10.20', ' GumGum: HB $10.21', ' GumGum: HB $10.22', ' GumGum: HB $10.23', ' GumGum: HB $10.24', ' GumGum: HB $10.25', ' GumGum: HB $10.26', ' GumGum: HB $10.27', ' GumGum: HB $10.28', ' GumGum: HB $10.29', ' GumGum: HB $10.30', ' GumGum: HB $10.31', ' GumGum: HB $10.32', ' GumGum: HB $10.33', ' GumGum: HB $10.34', ' GumGum: HB $10.35', ' GumGum: HB $10.36', ' GumGum: HB $10.37', ' GumGum: HB $10.38', ' GumGum: HB $10.39', ' GumGum: HB $10.40', ' GumGum: HB $10.41', ' GumGum: HB $10.42', ' GumGum: HB $10.43', ' GumGum: HB $10.44', ' GumGum: HB $10.45', ' GumGum: HB $10.46', ' GumGum: HB $10.47', ' GumGum: HB $10.48', ' GumGum: HB $10.49', ' GumGum: HB $10.50', ' GumGum: HB $10.51', ' GumGum: HB $10.52', ' GumGum: HB $10.53', ' GumGum: HB $10.54', ' GumGum: HB $10.55', ' GumGum: HB $10.56', ' GumGum: HB $10.57', ' GumGum: HB $10.58', ' GumGum: HB $10.59', ' GumGum: HB $10.60', ' GumGum: HB $10.61', ' GumGum: HB $10.62', ' GumGum: HB $10.63', ' GumGum: HB $10.64', ' GumGum: HB $10.65', ' GumGum: HB $10.66', ' GumGum: HB $10.67', ' GumGum: HB $10.68', ' GumGum: HB $10.69', ' GumGum: HB $10.70', ' GumGum: HB $10.71', ' GumGum: HB $10.72', ' GumGum: HB $10.73', ' GumGum: HB $10.74', ' GumGum: HB $10.75', ' GumGum: HB $10.76', ' GumGum: HB $10.77', ' GumGum: HB $10.78', ' GumGum: HB $10.79', ' GumGum: HB $10.80', ' GumGum: HB $10.81', ' GumGum: HB $10.82', ' GumGum: HB $10.83', ' GumGum: HB $10.84', ' GumGum: HB $10.85', ' GumGum: HB $10.86', ' GumGum: HB $10.87', ' GumGum: HB $10.88', ' GumGum: HB $10.89', ' GumGum: HB $10.90', ' GumGum: HB $10.91', ' GumGum: HB $10.92', ' GumGum: HB $10.93', ' GumGum: HB $10.94', ' GumGum: HB $10.95', ' GumGum: HB $10.96', ' GumGum: HB $10.97', ' GumGum: HB $10.98', ' GumGum: HB $10.99']' INFO:line_item_manager.gam_config:Auto-archiving Orders: [3242729885]

Notice the bidder name is referenced as " GumGum", as well as the "missing items" all have that same leading space in their names above. When looking at how the line items were created in GAM, they interestingly do not have that whitespace included, presumably therefore the reason why they can't be found per the output above.

When investigating, I noticed that https://docs.prebid.org/dev-docs/bidder-data.csv, which is used by the script to get the list of bidder names/codes/etc, has a space present after each comma (field) for all data except the header row, such as:

bidder-code,bidder-name,banner,video,native,schain,dchain,tcfeu,coppa,gpp,usp,safeframes,deals,client-adapter,server-adapter,user-ids,mobile-apps,floors,fpd,prebid-member,ortb-blocking,multiformat
...
...
...
gumgum, GumGum, yes, yes, no, yes, check with bidder, yes, check with bidder, yes, yes, check with bidder, check with bidder, yes, yes, unifiedId identityLink, yes, yes, check with bidder, no, check with bidder, check with bidder
...
...
...

If, however, I reference a local copy of bidder-data.csv with the leading spaces removed, such as below, the script runs as expected and no errors:

bidder-code,bidder-name,banner,video,native,schain,dchain,tcfeu,coppa,gpp,usp,safeframes,deals,client-adapter,server-adapter,user-ids,mobile-apps,floors,fpd,prebid-member,ortb-blocking,multiformat
...
...
...
gumgum,GumGum,yes,yes,no,yes,check with bidder,yes,check with bidder,yes,yes,check with bidder,check with bidder,yes,yes,unifiedId identityLink,yes,yes,check with bidder,no,check with bidder,check with bidder
...
...
...

python % line_item_manager create ./lineitemmanager/gumgum_11.00-40.00.yaml -k gam_creds_james.json -b gumgum --network-code [NETWORK_CODE_REMOVED] --network-name="Test GAM Account" INFO:line_item_manager.gam_config:################################################################################ INFO:line_item_manager.gam_config:Bidder: name="GumGum", code="gumgum" INFO:line_item_manager.gam_config:Key: "hb_pb_gumgum", Values: ['11.00', '12.00', '13.00', ..., '38.00', '39.00', '40.00'] INFO:line_item_manager.gam_config:############################################################ INFO:line_item_manager.gam_config:Media Type: "banner" INFO:line_item_manager.gam_config:Line Items: CPMs(min=11.00, max=40.00, count=30) INFO:line_item_manager.gam_config:Line Item Creative Associations: Creative Count=13 INFO:line_item_manager.gam_config:Line Item Creative Associations: Writing 390 records... 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 390/390 [00:53<00:00, 7.33it/s] python % line_item_manager

It seems the bidder-data.csv from prebid should be updated to remove the whitespace in the first place, but perhaps line-item-manager should/could also account for unexpected whitespace like this? (potentially the bidder-data.csv changed between Aug-8 and Aug-9 since I only ran into this starting Aug-9?)

Examples of helpful bin scripts

Description

Add examples directory with helpful bin scripts that use the line_item_manager package. For example an archive script that given a network code, json credentials file and an order id will archive the order.

Custom targeting hb_bidder contains all key-values

  • line-item-manager version: 0.2.1
  • Python version: 3.9.1
  • Operating System: MacOs

Description

I want to use single order approach for all bidders except Teads (because Teads do not support SafeFrame, I create separated order for them).

Inside config targeting set:

targeting:
  custom:
    - name: "hb_bidder"
      operator: "IS_NOT"
      values:
        - "teads"

But line items are created with targeting hb_bidder is none of sovrn, teads, appnexus. Basically it contains all values defined for hb_bidder key-value. Note: Some time ago I manually set hb_bidder for testing purposes. Seems that used operator or key-value type doesn't affect anything.

Targeting for created line item:
Screenshot 2021-03-04 at 12 45 28

Key-value settings:
Screenshot 2021-03-04 at 12 46 45

What I Did

line_item_manager create gam_universal_config.yml --single-order --test-run --private-key-file secrets/xxxx.json

YML config:

publisher:
  network_code: 1234
  network_name: "XXX"
advertiser:
  name: "Prebid"
creative:
  name: "prebid-{{ media_type }}"
  banner:
    sizes:
      - width: 200
        height: 200
      - width: 250
        height: 250
    snippet: |
      <script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
      <script>
        var ucTagData = {};
        ucTagData.adServerDomain = "";
        ucTagData.pubUrl = "%%PATTERN:url%%";
        ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
        ucTagData.hbPb = "%%PATTERN:hb_pb%%";

        try {
          ucTag.renderAd(document, ucTagData);
        } catch (e) {
          console.log(e);
        }
      </script>
order:
  name: "Prebid-{{ media_type }}-{{ time }} {{ cpm_min }}-{{ cpm_max }}"
line_item:
  name: "Prebid-{{ media_type }} @ {{ cpm }}"
  item_type: "price_priority"
targeting:
  custom: # list (optional)
    - name: "hb_bidder"
      operator: "IS_NOT" # optional: defaults to "IS"
      values:
        - "teads"
rate:
  currency: "CZK" # required
  granularity:
    type: "custom" # required, choices: "low", "med", "high", "auto", "dense", "custom"
    custom: # optional, requires type "custom" above
      - min: 0.10
        max: 135.00
        interval: 0.10


Option to remove existing line items

Sometimes it becomes important to remove line items one already has set up for a bidder. A bidder might not be generating enough be producing enough demand to justify its place in the stack, or start exhibiting payment problems. Or you might decide you want to rework their line items, perhaps changing the size of the increments between each item.

It would be great for the tool to offer a command to remove existing line items. If done right, this could both speed up the line item removal process, and provide some double-checks to make sure the correct line items are being removed.

Thank you for the tool!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.