Use tor in python or Configure tor in python.

Thinks to do.

1) Download tor from this link and install:- 
https://www.torproject.org/download/ 

2) After installing tor you will get Tor Browser folder 
in Tor Browser folder goto:- Tor folder you have search
as shows in the image below link:
https://ibb.co/hZ0Dx7W 

3) copy the all text from this links:-
https://gitweb.torproject.org/tor.git/tree/src/config/torrc.sample.in  
Past all code to notepad and save as torrc file name
and before saving you search for ControlPort 9051 and HashedControlPassword Uncomment this two lines 
as show'n in image link below and save the file.

https://ibb.co/M5vjsj6

4) Run tor.exe as administrator after running this file Run you need to install this packages.

1) pip install requests -- upgrade
2) pip install requests[socks]
3) pip install stem

5) Run your Python code for example as show'n below.

import requests


def get_tor_session():
    session = requests.session()
    # Tor uses the 9050 port as the default socks port
    session.proxies = {'http': 'socks5://127.0.0.1:9050',
                   'https': 'socks5://127.0.0.1:9050'}
    return session

# # Make a request through the Tor connection
# IP visible through Tor
session = get_tor_session()
print(session.get("http://httpbin.org/ip").text)
# Above should print an IP different than your public IP

# Following prints your normal public IP
print(requests.get("http://httpbin.org/ip").text)
Done.

Reference:-
1) https://www.youtube.com/watch?v=wJfa0qEzpJc
2) https://stackoverflow.com/questions/30286293/make-requests-using-python-over-tor




Comments

Popular posts from this blog

Error:java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant). at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:240) at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:215) at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:143) at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:78) at com.google.android.material.chip.ChipDrawable.loadFromAttributes(ChipDrawable.java:359) at com.google.android.material.chip.ChipDrawable.createFromAttributes(ChipDrawable.java:292) at com.google.android.material.chip.Chip.(Chip.java:193) at com.google.android.material.chip.Chip.(Chip.java:186) at com.google.android.material.chip.Chip.(Chip.java:182) at com.demo.nspl.restaurantlite.Navigation_Drawer.SalesFragment.getFilterChip(SalesFragment.java:158) at com.demo.nspl.restaurantlite.Navigation_Drawer.SalesFragment.lambda$onCreateView$0(SalesFragment.java:71) at com.demo.nspl.restaurantlite.Navigation_Drawer.-$$Lambda$SalesFragment$KCm-iiczjdYbpiNmaNw12gtFOoQ.onClick(lambda) at android.view.View.performClick(View.java:5268) at android.view.View$PerformClick.run(View.java:21550) at android.os.Handler.handleCallback(Handler.java:822) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)

Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html