Scripts to download pics from SpaceX API and hubble API.
Python3 should be already installed.
Then use pip
(or pip3
, if there is a conflict with Python2) to install dependencies:
pip install -r requirements.txt
Add instagram login, password and picture directory name to file .env
:
login
= %login%
password
= %password%
directory
= %directory%
To fetch images from SpaceX and Hubble library and upload them to your Instagram profile run script:
python3 instagram_upload.py
Command line interface is also available:
python3 instagram_upload.py --login %login% --password %password% --directory %directory%
Function fetch_spacex_last_launch()
from fetch_spacex.py
returns image urls list of last SpaceX launch.
Function fetch_hubble_urls(collection)
from fetch_hubble.py
returns image urls list of collection from Hublle.
Function save_images(image_urls, directory)
from tools.py
saves urls to directory.
Function crop_files_in_folder(folder_name)
from tools.py
crops images to square format.
Function load_pics(login, password, folder_path)
from instagram_upload.py
loads pictures to Instagram from folder with square pics.
The code is written for educational purposes on online-course for web-developers dvmn.org.