Forums

whitelist request: zenfolio.com

Zenfolio is a photo hosting/sharing site with a public API:

http://www.zenfolio.com/zf/tools/api.aspx

I have an app I'd like to try out on pythonanywhere if we can get this whitelisted for free users.

What domain does the API work from? I can't tell from their documentation...

Looking at the request headers I believe it is api.zenfolio.com

OK, that's whitelisted. Let us know if it works!

OK, I can talk to api.zenfolio.com, but not via HTTPS as this gives an EOF error. My app works fine on my computer so I think the problem might be with your proxy. Here is the traceback which goes into stdlib and presumably openssl:

Traceback (most recent call last):

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connectionpool.py", line 475, in urlopen conn = self._get_conn(timeout=pool_timeout)

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connectionpool.py", line 217, in _get_conn return conn or self._new_conn()

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connectionpool.py", line 656, in _new_conn return self._prepare_conn(conn)

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connectionpool.py", line 625, in _prepare_conn conn.connect()

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connection.py", line 98, in connect ssl_version=resolved_ssl_version)

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/util.py", line 634, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname)

File "/usr/lib/python3.3/ssl.py", line 217, in wrap_socket _context=self)

File "/usr/lib/python3.3/ssl.py", line 317, in init raise x

File "/usr/lib/python3.3/ssl.py", line 313, in init self.do_handshake()

File "/usr/lib/python3.3/ssl.py", line 520, in do_handshake self._sslobj.do_handshake()

ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:552)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.3/dist-packages/requests/adapters.py", line 334, in send timeout=timeout

File "/usr/local/lib/python3.3/dist-packages/requests/packages/urllib3/connectionpool.py", line 504, in urlopen raise SSLError(e)

requests.packages.urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:552)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/lblphoto/lbnlphotoclub/pyzenfolio/api.py", line 409, in call headers=self.get_request_headers())

File "/usr/local/lib/python3.3/dist-packages/requests/sessions.py", line 425, in post return self.request('POST', url, data=data, **kwargs)

File "/usr/local/lib/python3.3/dist-packages/requests/sessions.py", line 383, in request resp = self.send(prep, **send_kwargs)

File "/usr/local/lib/python3.3/dist-packages/requests/sessions.py", line 486, in send r = adapter.send(request, **kwargs)

File "/usr/local/lib/python3.3/dist-packages/requests/adapters.py", line 389, in send raise SSLError(e)

requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:552)

If it helps, here is the request I'm trying to make (taken from the logs: URL, json data, request header)

2014-07-04 00:01:13 https://api.zenfolio.com/api/1.7/zfapi.asmx

2014-07-04 00:01:13 {"params": [873396715, "Full", true], "method": "LoadGroup", "id": 15033}

2014-07-04 00:01:13 {"Content-Type": "application/json"}

If I simply change https to http, the request goes through fine, but it looks like stuff gets broken elsewhere in the app.

I get that same error when I try to run that code without using the proxy. On PythonAnywhere and on a local PC. Makes me suspect a problem at the zenfolio end?

it even happens with curl:

➜  ~  curl https://api.zenfolio.com/api/1.7/zfapi.asmx
curl: (35) Unknown SSL protocol error in connection to api.zenfolio.com:443

Ok, thanks for your help. I'll try to find a workaround.