├── README.md ├── interview_requirements.txt └── verify_tls.py /README.md: -------------------------------------------------------------------------------- 1 | # Python Interview Preparation 2 | 3 | Thanks for interviewing at Stripe. 4 | To make sure that we can use our time best in the interviews, 5 | we'd like to have you do some setup on your laptop in advance. 6 | If you don't have a laptop, let your recruiter know 7 | and they will supply you with a loaner laptop for your in-person interviews. 8 | 9 | First, _clone_ or _download_ this repository to your computer 10 | via the links on the right 11 | (creating a fork of the repository is not necessary). 12 | 13 | Note, we will be working with **Python 3** (Python 3.6 or later). 14 | See the [RealPython installation guide], if you haven't installed Python 3 yet. 15 | 16 | We'll create a [virtual environment] with [venv] 17 | and install some Python packages that will be useful in your interviews. 18 | 19 | > If for some reason you must use Python 2.7, 20 | > use [virtualenv] to create the virtual environment. 21 | 22 | **Create a new virtual environment** called `interview_env` and _activate_ it. 23 | 24 | ```bash 25 | $ python3 -m venv ./interview_env 26 | $ source ./interview_env/bin/activate 27 | ``` 28 | 29 | The `activate` script is for Bash and Zsh on Mac or Linux. 30 | For other shells, such as Fish or Csh, see the [venv] documentation. 31 | 32 | On Windows (assuming `cmd.exe`): 33 | 34 | ```batch 35 | > python3 -m venv .\interview_env 36 | > .\interview_env\Scripts\activate 37 | ``` 38 | 39 | Next, **install some requirements** into the activated virtual environment: 40 | 41 | ```bash 42 | (interview_env) $ pip install -r interview_requirements.txt 43 | ``` 44 | 45 | Finally, in that activated virtual environment, verify that your environment supports [TLS 1.2] or later: 46 | 47 | ```bash 48 | (interview_env) $ python verify_tls.py 49 | TLS 1.2 supported; no action required. 50 | ``` 51 | 52 | If you see a response that begins with `Error`, follow the instructions it provides. 53 | [MacOS SSL debugging] may be helpful. 54 | 55 | 56 | [RealPython installation guide]: https://realpython.com/installing-python/ 57 | [virtual environment]: https://realpython.com/python-virtual-environments-a-primer/ 58 | [venv]: https://docs.python.org/3/library/venv.html 59 | [virtualenv]: https://virtualenv.pypa.io/en/latest/installation.html 60 | [TLS 1.2]: https://pyfound.blogspot.com/2017/01/time-to-upgrade-your-python-tls-v12.html 61 | [MacOS SSL debugging]: https://stackoverflow.com/questions/58280484/ssl-module-in-python-is-not-available-on-osx/60467942#60467942 62 | -------------------------------------------------------------------------------- /interview_requirements.txt: -------------------------------------------------------------------------------- 1 | six==1.16.0 2 | requests==2.31.0; python_version > '3.6' 3 | requests==2.25.1; python_version <= '3.6' 4 | urllib3<2.0 5 | -------------------------------------------------------------------------------- /verify_tls.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import requests 4 | 5 | 6 | def main(): 7 | version = requests.get('https://www.howsmyssl.com/a/check').json()['tls_version'] 8 | if version < "TLS 1.2": 9 | url = "https://pyfound.blogspot.com/2017/01/time-to-upgrade-your-python-tls-v12.html" 10 | print("Error: The Stripe API requires TLS version 1.2, you are running {version}" 11 | "\n\nPlease see {url}\nfor instructions to update your environment.".format( 12 | version=version, url=url)) 13 | exit(1) 14 | print("TLS 1.2 supported; no action required.") 15 | 16 | 17 | if __name__ == "__main__": 18 | main() 19 | --------------------------------------------------------------------------------