// full error message
WARNING: You are using pip version 19.2.3, however version 20.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
// run
python -m pip install --upgrade pip --user --trusted-host files.pythonhosted.org --trusted-host pypi.org
Call API from Python
import requests
import urllib3
# suppress the HTTPS warnings in terminal
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# BEGIN
session = requests.Session()
session.verify = False
url = "https://some.url.com?param1=something¶m2=something"
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
# call the HTTP endpoint
httpResult = session.get(url, headers=headers)
print(httpResult.text)
# some extra details
elapsedSeconds = httpResult.elapsed.total_seconds()
statusCode = httpResult.status_code
Convert Python to Exe
#Install if needed
pip install pyinstaller
#Generate exe
C:/>pyinstaller -w -F myfile.py
format curl json
curl -X GET "http://api/path" -H "accept: application/json" | python -mjson.tool
Install Python tkinter
sudo apt-get install python3-tk
Install GPIO Python library
//Install pip:
sudo apt-get install python3-pip
// Install necessary libraries
//Option1: From text file
python3 -m pip install -r pip-commands.txt
// file contents
setuptools
RPi.GPIO
gpiozero
RPIO
pigpio
//Option2:
python3 -m pip install setuptools
python3 -m pip install RPi.GPIO
python3 -m pip install gpiozero
python3 -m pip install RPIO
python3 -m pip install pigpio
Install imagetk Python package
sudo apt-get install python3-pil.imagetk