Reddit Bots: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Line 37: Line 37:


=== Setting proxy in python ===
=== Setting proxy in python ===
Proxy is determined by the `http_proxy` OS environment variable.


<syntaxhighlight lang="python">
<syntaxhighlight lang="python">

Revision as of 14:41, 30 April 2022

OAuth2

Register an app on Reddit

  • Log in as the user who will be the owner of the app.
  • [1]
  • Click Create Another App...
    • Fill out the form.
    • Select personal use script if this app will run locally. This can't be changed later and the authentication is different for each kind of app, so a web app's credentials can't be used in a script app context.
    • Click Save App to generate a Client Id and Client Secret for the app.

The Client Id is displayed in the list of apps. The secret can be retrieved by clicking the Edit link by the app in the listings.

PRAW

The python praw library that is a wrapper for the Reddit API.

Obscuring IP address

Bot through proxy instead of VPN. [1]

  • Proxies are faster than VPNs.
  • A VPN is a single connection, so still a single IP.
  • Proxies allow multiple connections at once, so many IPs.

Acquiring proxies

Things to look up: residential vs private proxies.

Don't know if this site is legit or not but there is info here: Best Reddit Proxies of 2022 - Best Proxy Reviews

Some suggestions to follow up on:

Setting proxy in python

Proxy is determined by the http_proxy OS environment variable.

import os

proxy = 'http://<user>:<pass>@<proxy>:<port>'

os.environ['http_proxy'] = proxy 
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy

See also

External links

References