Giter Club home page Giter Club logo

Comments (6)

voussoir avatar voussoir commented on September 6, 2024

Timesearch doesn't make any HTTP requests on its own, everything is done through PRAW. And then, TS does not instantiate its own Praw, it imports your bot file [0] and calls either bot.anonymous() [1] or bot.login() depending on what it needs.

So if you write a bot file that uses proxies in the PRAW instance you should be good to go. I have never tried them myself.

However you have just made me find a bug. Back in the PRAW3 days we were able to take a logged out session and log it in. But in PRAW4 all of the credentials are passed into the constructor so we have to create new separate objects when we log in. As such I think many of the login lines [2] are probably broken. I can push a fix for those that overwrites common.r with the new instance.

Edit: 5d1c2f8

[0]: https://github.com/voussoir/reddit/blob/760a57322f96207bcbd40f5bf01d0916d89bf0b7/bot4.py

[1]:

r = bot.anonymous()

[2]:

common.bot.login(common.r)

from timesearch.

Brotakuu avatar Brotakuu commented on September 6, 2024

Thanks for the explanation. So I can set the HTTPS_PROXY env in my bot.py (using the bot.py example in the README) file and it should pass to the PRAW instance?

HTTPS_PROXY=https://localhost:3128

from timesearch.

voussoir avatar voussoir commented on September 6, 2024

Hmm, I was expecting proxies to be an argument into the praw.Reddit constructor. I guess they are just environment variables and Requests will detect them automatically. I didn't know that.

http://praw.readthedocs.io/en/latest/getting_started/configuration.html?highlight=proxy#using-an-http-or-https-proxy-with-praw

In that case, you might be able to set this variable during bot.py

...
import os
os.environ['HTTPS_PROXY'] = '...'

import praw

USERAGENT = '...'
...

But I don't know when Requests gathers the proxy from the env variables. By the time bot.py gets run, it may be too late. I would suggest setting this environment variable from the commandline or your OS's environment variable editor before running the script.

from timesearch.

Brotakuu avatar Brotakuu commented on September 6, 2024

That makes sense, thank you for the quick reply and for making timesearch.

A bit of a tangent, but with the removal of timestamp search (starting today to the end of march), are there any possible workarounds to keeping timesearch working?

Also, I assume commentaugment and livestream should continue to work?

from timesearch.

voussoir avatar voussoir commented on September 6, 2024

Just to clarify, if you create a variable in bot.py called HTTPS_PROXY it will not do anything. It needs to be an environment variable, which is something that exists on your operating system. It's not a Python variable. This means you need to use os.environ to set it, or do it on the command line before starting Python.

In Windows we use set HTTPS_PROXY=... to make temporary env vars, and setx HTTPS_PROXY "..." to make permanent ones.

On Linux I think they just use HTTPS_PROXY=... for temporary and export HTTPS_PROXY "..." for permanent. That's why the PRAW docs show HTTPS_PROXY=https://localhost:3128 ./prawbot.py.

from timesearch.

voussoir avatar voussoir commented on September 6, 2024

No problem, thanks for bringing up this issue.

With the death of reddit's timestamp query, I cannot think of any pure-PRAW way to continue doing timesearch. /u/Stuck_in_the_Matrix runs a website called PushShift.io which has an API that could probably replace this feature. This may be something I can do but to be honest it's not going to be immediately. Maybe I can talk to him about it.

Yeah, all of the other tools should continue to work fine.

from timesearch.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.