I'm querying the Mixpanel API pretty consistently, but every so often, the request does not go through and I am given this error:
urllib2.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
I did some searching and there might be some caching issues, so I tried this in terminal:
dscacheutil -flushcache
I tried the above last night and it worked, but now when I am greeted with the same error and I try to flush the cache, I am still given the same error.
There haven't been any code changes that would have given me this error.
Any thoughts why this is happening?
P.S. Yes, I know urllib2 blows.  I would prefer to be using requests, but the urllib2 calls are in a mixpanel client and I'd prefer not to mess around with it.
The problem seemed to be solved by a combination of Ajay's comment:
Try after installing this pip install pyopenssl ndg-httpsclient pyasn1 if you are using python2
and the OS X Yosemite version of DNS cache flushing:
sudo discoveryutil mdnsflushcache
urllib2 request randomly stops working without code changes