{"id":13411533,"url":"https://github.com/JoseVL92/web-requester","last_synced_at":"2025-03-14T17:30:55.747Z","repository":{"id":62569669,"uuid":"206081643","full_name":"JoseVL92/web-requester","owner":"JoseVL92","description":"HTTP sync / sync library that works with both: requests and aiohttp, exploiting the best of each one","archived":false,"fork":false,"pushed_at":"2022-05-19T19:27:20.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-09T13:30:55.728Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoseVL92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-03T13:15:38.000Z","updated_at":"2022-05-12T14:51:49.000Z","dependencies_parsed_at":"2022-11-03T17:02:20.068Z","dependency_job_id":null,"html_url":"https://github.com/JoseVL92/web-requester","commit_stats":null,"previous_names":["josevl92/http-requests"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoseVL92%2Fweb-requester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoseVL92%2Fweb-requester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoseVL92%2Fweb-requester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoseVL92%2Fweb-requester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoseVL92","download_url":"https://codeload.github.com/JoseVL92/web-requester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618635,"owners_count":20320269,"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-07-30T20:01:14.298Z","updated_at":"2025-03-14T17:30:55.460Z","avatar_url":"https://github.com/JoseVL92.png","language":"Python","funding_links":[],"categories":["Web Development"],"sub_categories":["Python"],"readme":"\n\n# web-requester\n\n## Easily and efficiently perform concurrent http requests with Python  \n  \nMake several requests with common options for all, or specific options for each of them.  \n  \n**aiohttp** library will be used only for default behavior (text retrieving, no callback) and if not explicitly disabled  via `{'allow_aio' = False}` in common_options. **requests** will be used otherwise\nOptions dictionary has shape (for example):  \n```json\n{  \n    \"method\": \"get\",  \n    \"data\": b\"Hola Mundo!!!\",\n    \"params\": {\"q\": \"frase a buscar\"},\n    \"json\": [{ \"si\": \"no\" }],  \n    \"proxy_cfg\": {\"http\": \"http://miproxy\"},\n    \"headers\": {\"Content-Type\": \"application/pdf\"},  \n    \"allow_aio\": True,\n    \"aio_client\": some_aiohttp_client,\n    \"timeout\": 15,  \n    \"logger\": some_logger,  \n    \"callback\": some_function\n}\n```\n\n### Some points to notice:\n- **method**: 'get' by default\n- **data**: used only in non-get requests\n- **params**: used only in 'get' requests\n- **proxy**: could have also the \"http://user:pass@host:port\" format\n- **allow_aio**: enables or disables the use of _aiohttp_. If False, it ensures the use of _requests_ always and excludes _aiohttp_. Default: True\n- **aio_client**: _aiohttp.ClientSession_. It's the only option that, if present, must be global, not specific for a single url\n- **logger**: a _logging.logger_ instance\n- **callback**: _function_ that receives a _requests.Response_ as argument\n\n\u003e _If callback exists, the URL will be fetched using 'requests' only for standardization_\n\n**Args:**\n* **urloptions_list**: tuple (url, opts), where 'url' is the url of the request, and opts is a dictionary with specific options  \n* **common_options**: dictionary with common options for every request, if that request does not specify its own options  \n  \n**Returns**: A list of responses defined by each specific callback or the general callback, or each response text by default\n\n### How to use\n```python\nfrom web_requester import request_all\n\nurls = ['https://google.com',\n        ('https://actualidad.rt.com', {'json': {'num': 2}}),\n\t'http://www.cubadebate.cu',\n\t('https://www.filehorse.com/es', {'timeout': 12})]\n\nresponse_list = request_all(urls, {'method': 'get', 'timeout': '10'})\n ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJoseVL92%2Fweb-requester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJoseVL92%2Fweb-requester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJoseVL92%2Fweb-requester/lists"}