{"id":22494715,"url":"https://github.com/niv-devops/python-lambda-api","last_synced_at":"2025-07-10T15:33:35.468Z","repository":{"id":264220796,"uuid":"892737560","full_name":"niv-devops/python-lambda-api","owner":"niv-devops","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-01T16:14:58.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T01:13:12.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niv-devops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-22T17:20:08.000Z","updated_at":"2024-12-01T16:15:02.000Z","dependencies_parsed_at":"2025-05-26T13:50:06.761Z","dependency_job_id":"dbeafc80-3d83-4037-a48a-8a164b6718c5","html_url":"https://github.com/niv-devops/python-lambda-api","commit_stats":null,"previous_names":["niv-devops/python-scripts","niv-devops/python-lambda-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niv-devops/python-lambda-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niv-devops%2Fpython-lambda-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niv-devops%2Fpython-lambda-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niv-devops%2Fpython-lambda-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niv-devops%2Fpython-lambda-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niv-devops","download_url":"https://codeload.github.com/niv-devops/python-lambda-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niv-devops%2Fpython-lambda-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261125626,"owners_count":23113276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T19:16:49.519Z","updated_at":"2025-06-21T12:36:01.886Z","avatar_url":"https://github.com/niv-devops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Scripts for GitLab \u0026 Google Sheets\n\nThis repository contains a collection of Python automation scripts designed to interact with GitLab and Google Sheets APIs.\n\n## Features\n\n1. **create_user.py**: Creates new GitLab user and repo based on data parsed from Google Sheets.\n2. **csv_to_excel.py**: Converts CSV file into Excel file.\n3. **get_info.py**: Appends Wikipedia topic's summary section into text file.\n4. **backup.py**: Daily backups of files, auto clean to save latest file once a week \u0026 month.\n5. **new_project.py**: Locally creates project's folder, pushes it to GitLab and opens it on VScode.\n6. **send_whatsapp.py**: Sends whatsapp messages to predefined list of contacts in Google Sheets.\n\n## Prerequisites\n1. [Google Sheets API](https://developers.google.com/sheets/api/guides/concepts)\n2. [Google Sheets - Python API](https://developers.google.com/sheets/api/quickstart/python)\n3. [GitLab Server Setup](https://about.gitlab.com/install/)\n4. [WhatsApp Web](https://web.whatsapp.com)\n\n## Setup\n\n1. Follow the instructions in `Prerequisites` guides. Make sure to enable `Google Sheet API` \u0026 `Google Drive API` in the google console.\n\n2. Generate and Download the credentials.json File:\n   * Go to `Credentials` tab in the console \u003e `Service Accounts` \u003e `Keys` \u003e `Create New Key` \u003e Select `JSON` as the key type and click `Create`.\n\n   * Rename the file to `credentials.json` and save it in the same dir as the scripts.\n\n   * Save the service account's email address for next step. Example address: my-service-account@your-project.iam.gserviceaccount.com\n\n3. Create Google Sheets for the data to parse\n    * **Python script GitLab**:\n\n      | **Name**     | **Username** | **Email**            | **Password** |\n      |--------------|--------------|----------------------|--------------|\n      | John Doe     | johndoe      | johndoe@example.com  | password123  |\n      | Jane Smith   | janesmith    | janesmith@example.com| password456  |\n\n      ---\n    * **Python script whatsapp**:\n\n      | **Phone Number**  | **Message**                           |\n      |-------------------|---------------------------------------|\n      | +972123456789     | Hello, this is an automated message!  |\n      | +972987654321     | This is another automated message.    |\n\n    * **Share the Google Sheet with the Service Account**: Open both of your Google Sheets in your browser \u003e Click on `Share` \u003e Insert the `service account's email address` from previous step \u003e Grant `Editor` permission.\n\n4. Ensure you have the `credentials.json` file from Google Cloud Console for Sheets API access.\n\n5. Create `docker-compose.yml` for your GitLab server and run it\n   ```yaml\n   services:\n    gitlab:\n      image: gitlab/gitlab-ce:latest\n      container_name: gitlab\n      restart: always\n      hostname: gitlab.local\n      environment:\n        GITLAB_OMNIBUS_CONFIG: |\n          external_url 'http://gitlab.local'\n      ports:\n        - \"9090:80\"\n        - \"443:443\"\n        - \"2222:22\"\n      volumes:\n        - gitlab_data:/var/opt/gitlab\n        - gitlab_logs:/var/log/gitlab\n        - gitlab_config:/etc/gitlab\n\n   volumes:\n     gitlab_data:\n     gitlab_logs:\n     gitlab_config:\n   ```\n\n   * Run `docker-compose up -d` to start the server\n   * View the logs with `docker compose logs -f`\n   * Go to `http://localhost:9090`\n   * Username: admin\n   * Password: `docker exec -it gitlab cat /etc/gitlab/initial_root_password`\n\n6. Install requirements in virtual environment\n   ```bash\n   python3 -m venv .venv\n   source .venv/bin/activate\n   pip install -r requirements.txt\n   ```\n\n7. Create `.env` file\n   ```bash\n   nano .env\n   ```\n   Insert the following environment variables:\n   ```bash\n   GITLAB_USERNAME=\u003cyour_gitlab.com_username\u003e\n   GITLAB_TOKEN=\u003cyour_gitlab.com_api_token\u003e\n   GITLAB_SERVER_USERNAME=\u003cyour_gitlab_server_username\u003e\n   GITLAB_SERVER_TOKEN=\u003cyour_gitlab_server_api_token\u003e\n   GROUP_ID=\u003cyour_gitlab_server_group_id\u003e\n   ```\n\n## Usage\n\n1. Run the script (Example uses)\n   ```bash\n   python3 create_user.py\n   python3 csv_to_excel.py \u003cpath/to/csv_file.csv\u003e\n   python3 get_info.py \u003cwikipedia_topic\u003e\n   python3 new_project.py \u003cproject_name\u003e\n   python3 send_whatsapp.py\n   ``` \n2. Note that `backup.py` runs with Crontab\n   ```bash\n   crontab -e\n   0 18 * * * /usr/bin/python3 /path/to/backup.py\n   ``` \n\n## Cleanup\n\n* Deactivate virtual environment with `deactivate` command.\n* Stop GitLab's server container with `docker compose down`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniv-devops%2Fpython-lambda-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniv-devops%2Fpython-lambda-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniv-devops%2Fpython-lambda-api/lists"}