{"id":26382670,"url":"https://github.com/annabien/library-e-resources","last_synced_at":"2026-04-20T09:03:38.041Z","repository":{"id":275799234,"uuid":"865958973","full_name":"AnnaBien/Library-e-resources","owner":"AnnaBien","description":"Selenium-based application to automate form submissions.","archived":false,"fork":false,"pushed_at":"2025-02-04T16:10:15.000Z","size":29,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T06:18:07.790Z","etag":null,"topics":["docker","googlecloudplatform","python","selenium"],"latest_commit_sha":null,"homepage":"","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/AnnaBien.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}},"created_at":"2024-10-01T12:10:05.000Z","updated_at":"2025-02-04T16:10:18.000Z","dependencies_parsed_at":"2025-02-04T17:34:10.209Z","dependency_job_id":null,"html_url":"https://github.com/AnnaBien/Library-e-resources","commit_stats":null,"previous_names":["annabien/library-e-resources"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnnaBien/Library-e-resources","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnaBien%2FLibrary-e-resources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnaBien%2FLibrary-e-resources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnaBien%2FLibrary-e-resources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnaBien%2FLibrary-e-resources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnnaBien","download_url":"https://codeload.github.com/AnnaBien/Library-e-resources/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnaBien%2FLibrary-e-resources/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32040353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docker","googlecloudplatform","python","selenium"],"created_at":"2025-03-17T06:18:09.906Z","updated_at":"2026-04-20T09:03:38.021Z","avatar_url":"https://github.com/AnnaBien.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library e-resources\n\n[Provincial Public Library](https://www.rajska.info/) is providing special codes that allow library members to get a free monthly subscription to the Legimi or EmpikGo apps.\nTo get the code a library member has to fill out an online form and submit it at the beginning of each month. \nWhen the code is obtained (sent via e-mail) it has to be activated at dedicated website.\nMore information available on library website: [Legimi](https://www.rajska.info/e-zasoby-legimi) or [EmpikGo](https://www.rajska.info/e-zasoby-empikgo)\n\n---\n\n#### This project automates the process of submitting an online form requesting the codes for a free Legimi or EmpikGo subscription.\n\n\nNote! Although the process of submitting form is fully automated, you still need to activate the code obtained via e-mail yourself.\n\n\n## Why was this project developed?\n\nDue to the popularity of e-resources.\nUnfortunately the number of available codes is limited and the order of applications decides.\n\nThe form is available from the first of each month and must be sent every month to keep your subscription.\nIn practice, the form should be sent not too long after midnight, otherwise you may forget to receive the code.\n\nThis really complicates the ease of the process. Sometimes you may miss the right time to submit a form or just want to get to bed early.\nThese are enough reasons why it is nice to have such things automated.\n\n## Deployment\n\nGoogle Cloud is used to deploy this project. \nEach directory ```container_deploy```, ```container_delete``` and ```selenium_app``` contains code of single Cloud Run Function.\nFile ```main.py``` present in each project is required and contains the entry point for Cloud Run Functions.\n\nNote! These projects are separeted from each other which resulted in repetition of ```logger.py``` file. \n\n### Cloud Run Function: Container deploy\n\nImplements function responsible for deploying a container [selenium/standalone-chrome](https://hub.docker.com/r/selenium/standalone-chrome), which is needed to handle all\nSelenium WebDriver requests. A container is deployed from image previously added into google project's artifact registry.\n\nFor this function a custom IAM service account must be created as function needs special permissions to manipulate Cloud Run resources:\n- Cloud Run Admin - to grant the run.services.setIamPolicy permission\n- Service Account User - to grant the iam.serviceAccounts.actAs permission\n\n### Cloud Run Function: Selenium App\n\nThis project implements the functionality of filling out and submitting an online form.\nThe Selenium library is used in conjunction with the WebDriver interface, which communicates remotely with a previously deployed container.\n\n\n### Cloud Run Function: Container delete\n\nRemoves the standalone-chrome container when the Selenium application finishes its tasks.\n\n### Cloud Scheduler\n\nScheduler is used to invoke Cloud Run Functions by sending HTTP GET request at certain URLs.\nApplication is scheduled to deploy a container at 12.00 AM the first day of the month. \nNext at 12.03 AM Cloud Scheduler sends an HTTP request that triggers the application.\nAt the end the last function is invoked to delete the container.\n\nIngress traffic is limited to internal only for each Cloud Run Function.\n\n## Running on localhost\n\nIf you do not feel fancy enough to use Google Cloud, run this code on your localhost.\nOnly make sure you have the Chrome browser already installed or preferably run a selenium/standalone-chrome container.\nCheck [selenium/standalone-chrome dockerhub page](https://hub.docker.com/r/selenium/standalone-chrome) for instructions how to run a container.\n\n\nFirstly prepare your environment:\n```bash\ncd selenium_app\npip install -r requirements.txt\n```\n\nComment out or delete below lines from ```logger.py```:\n\n```python\nCLIENT = google.cloud.logging.Client()\nCLIENT.setup_logging()\n```\n\nNow you can fill out your data and run below code instead of ```main.selenium_client```:\n\n```python\nfrom selenium_app.request_resource_access import RequestResourceAccess\nfrom selenium_app.form_data import EResourceType\n\nuser_data = [\n    {\n        'library_card_no': '213721',\n        'email': 'example@gmail.com',\n        'resource_type': EResourceType.empikgo.value\n    }\n]\nresource_request_instance = RequestResourceAccess(cmd_exec_url='http://127.0.0.1:4444')\nresource_request_instance.wait_until_form_is_available()  # you may want to extend the waiting time\nresource_request_instance.fill_form_and_send(user_data)\n\n```\n\nNote! Application will raise a RequestNotSend exception while the online form is not available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannabien%2Flibrary-e-resources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fannabien%2Flibrary-e-resources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannabien%2Flibrary-e-resources/lists"}