feat: add proxy-aware clients, reports workflow, and tests#1
feat: add proxy-aware clients, reports workflow, and tests#1
Conversation
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| .PHONY: reports test | ||
|
|
||
| reports: | ||
| CLIENT?=partacademy |
There was a problem hiding this comment.
Makefile uses Make syntax inside shell recipe
The CLIENT?=partacademy line is inside the recipe (indented with a tab), so it gets executed by the shell rather than Make. The ?= conditional assignment operator is Make syntax, not valid shell syntax. This causes make reports to fail with a shell error. The assignment needs to be at the Makefile's top level (unindented), or use shell syntax like ${CLIENT:-partacademy} inside the recipe.
| "api-metrika.yandex.net", | ||
| "api-metrika.yandex.ru", | ||
| "api-metrika.yandex.com", | ||
| "api.webmaster.yandex.ru", |
There was a problem hiding this comment.
NO_PROXY list uses wrong domain for webmaster API
The DEFAULT_NO_PROXY_HOSTS list includes api.webmaster.yandex.ru, but ym_webmaster_client.py uses api.webmaster.yandex.net as the API endpoint. This domain mismatch means webmaster API requests will still go through the corporate proxy instead of bypassing it, likely causing the documented 403 Forbidden errors.
Additional Locations (1)
| _get_credentials() | ||
| session = _session() | ||
| url = f"{GSC_API}/sites" | ||
| return request_json(session, "GET", url) |
There was a problem hiding this comment.
GSC client validates credentials but doesn't use them
The get_sites() function calls _get_credentials() to validate that GSC_CLIENT_ID and GSC_REFRESH_TOKEN are set, but discards the return value and makes the API request without any authentication headers. This is inconsistent with metrika_client and ym_webmaster_client which properly use their tokens. Users will be prompted to set credentials that have no effect, and the request will always fail with 401 Unauthorized from Google's API.
| if config.extra_no_proxy: | ||
| merged_no_proxy = _merge_no_proxy(merged_no_proxy, config.extra_no_proxy) | ||
|
|
||
| proxies["no_proxy"] = merged_no_proxy |
There was a problem hiding this comment.
Proxy bypass via no_proxy dict key is ignored
The requests library does not honor a no_proxy key in the session.proxies dictionary - it only reads NO_PROXY from environment variables when trust_env=True. Setting proxies["no_proxy"] has no effect, so the DEFAULT_NO_PROXY_HOSTS for Yandex and Google APIs won't bypass the proxy as intended. The entire proxy bypass mechanism for these API domains is non-functional.
Summary
Testing
Codex Task
Note
Adds a runnable, proxy-aware data collection scaffold and basic workflow.
app/http_client.pywith env-driven proxy/NO_PROXY handling, default timeouts, andrequest_jsonmetrika_client.py,ym_webmaster_client.py,gsc_client.py(env-based auth; simple list/get calls)analysis_sources.py,analysis_pages.py,analysis_goals.py,analysis_gsc.py,analysis_ym_webmaster.pyMakefiletargets:reports(prints fetched data) andtestREADME.mdwith setup/usage; addsdocs/cursor_tasks.mdfor restoration tasksrequests,pytest) and adds smoke tests for HTTP helper and config loading (tests/test_http_client.py,tests/test_config.py)Written by Cursor Bugbot for commit 3cf1a3b. This will update automatically on new commits. Configure here.