Fetch Internet Archive Item Metadata Through a Proxy in Python
Configure ArchiveSession before metadata retrieval, and keep that session alive for its item's later operations.
from internetarchive import ArchiveSession
with ArchiveSession() as session:
session.trust_env = False
session.proxies.update({
'http': 'http://proxy.example:8080',
'https': 'http://proxy.example:8080',
})
item = session.get_item(identifier)
print(item.identifier)identifier names the intended item. With no supplied metadata, session.get_item downloads it and attaches this session to the item. Keep subsequent item work inside the session lifetime; a module-level call elsewhere can create another session. For permitted public-item metadata downloads, the HTTP proxy list supplies candidates for the session’s HTTP proxy URLs.
trust_env=False disables Requests’ environment integration, preventing inherited routing from replacing the explicit map and disables environment-derived CA selection. Set session.verify to the required trust bundle when needed.
The Archive account keeps its normal permissions. This setup selects the transport route, not service authorization.