project-a / bingads-performance-downloader

A script for downloading performance from BingAds API
MIT License
11 stars 9 forks source link

Could you clarify the usage of ssl? #1

Closed LarsBuur closed 7 years ago

LarsBuur commented 7 years ago

I have tried with both http://localhost and https://localhost as in the web redirect url.

I have noticed that there is a "allowHttpForRedirectUrl: true" but I have not idea on how to enable it.

Thank you. The stacktrace is:

^[[ATraceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
    _context=self, _session=session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
LarsBuur commented 7 years ago

Another thing: Is it deliberate that what seems to be your real developer token is in the repository: See /bingads_downloader/config.py

Tafkas commented 7 years ago

From your stack trace it looks like you are using macOS. When you install Python through the official installer it doesn't install any certificates doesn't install any certificates.

Just browse to Applications/Python 3.6 and double-click Install Certificates.command

LarsBuur commented 7 years ago

Hi Christian, I got it working. After the ssl certificates worked I ran into a problem with my app not being registered as a "mobile" app - but going through one of their guides fixed that. Thank you.

martin-loetzsch commented 7 years ago

About the developer token: they were randomized strings. But we made that a bit clear now: https://github.com/mara/bingads-performance-downloader/blob/master/bingads_downloader/config.py