Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinGPT Proxy Header Rotation

From Leeroopedia
Knowledge Sources
Domains Web_Scraping, Proxy_Management, RAG
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for rotating user-agent headers and fetching free proxies to evade anti-bot detection during web scraping provided by the FinGPT RAG multisource_retrieval subproject.

Description

The headers module maintains a pool of ~20 user-agent strings (Chrome, Firefox, IE/Trident) and provides `getFreeProxies` to scrape free-proxy-list.net, `getProxy` to return a working proxy, and `getHeaders` to return rotated headers for a given site (Seeking Alpha, NASDAQ).

Usage

Import these functions when you need to make HTTP requests to financial news sites while evading simple anti-bot measures.

Code Reference

Source Location

Signature

class Site(Enum):
    SA = 1
    NASDAQ = 2

def getFreeProxies() -> list[str]:
    """Scrape free-proxy-list.net and return proxy URLs."""

def getProxy() -> str | None:
    """Return a working proxy from the free list."""

def getHeaders(site) -> dict:
    """Return rotated headers for a given Site enum value."""

Import

from proxies.headers import getProxy, getHeaders, Site

I/O Contract

Inputs

Name Type Required Description
site Site Yes (getHeaders) Target site enum (SA, NASDAQ)

Outputs

Name Type Description
proxy None Working proxy URL or None
headers dict HTTP headers with rotated User-Agent

Usage Examples

Make a Rotated Request

import requests
from proxies.headers import getHeaders, getProxy, Site

headers = getHeaders(Site.SA)
proxy = getProxy()

proxies = {"http": proxy, "https": proxy} if proxy else None
response = requests.get("https://seekingalpha.com/symbol/AAPL",
                        headers=headers, proxies=proxies)
print(response.status_code)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment