Skip to content

Instantly share code, notes, and snippets.

@tienntr
Last active October 9, 2023 04:03
Show Gist options
  • Save tienntr/e7269bbea1d726a2097b5622085136a0 to your computer and use it in GitHub Desktop.
Save tienntr/e7269bbea1d726a2097b5622085136a0 to your computer and use it in GitHub Desktop.
User agent changing

Replace user-agent with privoxy

/etc/privoxy/user.action

{+hide-user-agent{Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0} \
}
/

Pip

Privoxy doesn't work with Python 3.10 pip because the latter doesn't set UA. Temporay hack:

  • Create venv
  • Edit <venv>/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py, change function proxy_header in class HTTPAdapter to add a 'User-Agent' header to the return dict.
  • Use pip from the venv.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment