(2020-08-09) Reviving TwitterBots

Wanted to revive my broken TwitterBots - (2018-07-16) CoachBot Random Reminders

  • reset password on Twitter account
  • got keys - they didn't work
File "/Users/billseitz/Documents/djcode/st/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
  • tried python get_access_token.py
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1119, in getresponse
    raise ResponseNotReady()
httplib.ResponseNotReady
  • resort to trying to decode changelogs. Ah Jul25'2019: Today, all connections to the Twitter API (and all other Twitter domains) will require TLS 1.2. That seems like a likely culprit.
  • now what?
  • probably switch back-end to Leonard Richardson's BotFriend library.
  • of course I'm going to have to upgrade TLS first.
    • looking back at OpenSSL notes from 2017.... maybe I'll just change languages...
  • trying these instructions
    • had to add the --force option because keg-only
    • when I try pip install virtualenv I get
Collecting virtualenv
  Could not fetch URL https://pypi.python.org/simple/virtualenv/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping
  • import ssl; ssl.OPENSSL_VERSION -> 'OpenSSL 0.9.8zh 14 Jan 2016 jfc
  • try brew install openssl
  • lots of steps happen, but finally
==> make install
🍺  /usr/local/Cellar/gdbm/1.18.1_1: 25 files, 620.9KB, built in 19 seconds
==> Installing python@2
Error: An exception occurred within a child process:
  FormulaUnavailableError: No available formula with the name "/usr/local/opt/python@2/.brew/python@2.rb" 
  • no change to ssl.OPENSSL_VERSION
  • try those notes near end of OpenSSL page. Nope.
  • follow the link at bottom of that page - try brew info openssl then do the export PATH bit it suggests. Nope no good.
  • check those paths - vi ~/.zshrc (actually nano)
  • comment out the lines that refer to openssl instead of openssl@1.1, open new Terminal window. Nope still wrong version.
  • earlier got some warnings about XCode so figured I'd upgrade that. (deep into CargoCult here) (all this is probably made worse by (a) wanting to stick with Python 2.x, and (b) using a 6yo MacBookPro running Sierra (10.12.6).)
    • of course the AppStore app is just spinning... I finally just quit it, that probably doesn't matter
  • do this to upgrade pip
  • then did pip install virtualenv and it worked!
  • but if launch/enter my virtualenv and launch Python it's still using the old OpenSSL, so just ran in a circle
  • trying this list - deleting lots of old Pythons.
    • at some point brew says I don't have Python, and won't let me install Python2. Known issue. Seemed to install, but still old OpenSSL.

Maybe time to give up and try Python3?

  • straight brew install python nope not happy
  • try this
    • first step failed - because won't work with Sierra, or does that just mean support?

Edited:    |       |    Search Twitter for discussion