Skip to content

Let v201708 sample script "add_responsive_display_ad.py" compatible with Python 3.x #224

Closed
@JamesHuang123

Description

@JamesHuang123

The v201708 sample script "add_responsive_display_ad.py" uses package urllib2 to fetch internet image resource. However urllib2 is not available in Python 3.x and is replaced with urllib.request, but when I used urllib.request for this line and execute the full code

opener = urllib.request.build_opener(*client.proxy_config.GetHandlers())

The program return an message 'Unmarshalling Error: cvc-datatype-valid.1.2.1: 'b'/9j/4AAQSkZJRgABAQAAAQAB...........(a long encoded string)...' is not a valid value for 'base64Binary'.

We tried switching back to Python 2.x and run the code with urllib2, then the program works perfectly, but not with urllib.request under Python 3.x environment. So it seems this sample code is not compatible with Python 3.x which urllib2 is not available. Please help update the library to be compatible with both Python 2.x and Python 3.x if possible.

many thanks,

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions