Before you begin, it's recommended to create a new virtual environment for this project. This helps keep dependencies required by different projects separate by creating isolated environments for them.
-
Create a Virtual Environment:
-
For Windows, open Command Prompt and run:
python -m venv venv
-
For macOS/Linux, open Terminal and run:
python3 -m venv venv
This command creates a new virtual environment named
venvin your project directory. Feel free to replacevenvwith a different name if desired. -
-
Activate the Virtual Environment:
-
On Windows, execute:
.\venv\Scripts\activate
-
On macOS/Linux, use:
source venv/bin/activate
Once activated, your shell prompt will include the name of the virtual environment, indicating all Python and pip commands are isolated to this environment.
-
-
Clone the Repository:
Replace
your-repository-urlwith the actual URL of your project repository:git clone https://your-repository-url.git cd your-project-directoryChange
your-project-directoryto the name of the folder where your project is located. -
Install Required Packages:
Within the activated virtual environment, install the project dependencies:
pip install -r requirements.txt
This project requires the following Python libraries:
python-dotenv: For loading environment variables.requests: To make HTTP requests.pexels_api: A wrapper for the Pexels API.
Ensure Python 3.x is installed on your machine to successfully run the project.
To start the application, execute the following command from the root directory of the project:
python main.pyThis script initializes the application, fetching images based on the specified search query within main.py. By default, the application searches for "cats". Adjust the search query in the search_api parameter of main.py to explore different content.
main.py: The main Python script that executes the application logic.api/connector.py: Contains thepexelclass for interacting with the Pexels API.requirements.txt: Lists all the necessary Python packages.
Once the application is running, it will print out details for each fetched image, including the photographer's name, photo URL, and the URL for the original image size.
Contributions to this project are welcome! Please fork the repository and submit a pull request with your proposed changes. For major changes, please open an issue first to discuss what you would like to change.