Comments (6)
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]:
timesearch/timesearch/common.py
Line 27 in 0ec6002
[2]:
timesearch/timesearch/timesearch.py
Line 28 in 0ec6002
from timesearch.
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.
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.
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.
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.
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.
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)
- received 400 HTTP response HOT 9
- insert_filler missing 1 required positional argument HOT 7
- AttributeError: 'DummySubmission' object has no attribute 'url' on some subreddits HOT 2
- import timesearch_modules error HOT 3
- get_submissions doesn't work for some subreddits HOT 4
- new error since today for comment download
- New issue with praw HOT 2
- 404 for https://api.pushshift.io/meta HOT 7
- parent_id attribute for comments from pushshift API
- Recovering from exception HOT 2
- dont work no more any way around with local dumps?? HOT 4
- Getting deleted posts/comments? HOT 4
- Offline Reading <> Invalidates HTML HOT 3
- Missing license HOT 1
- No module named 'bot4' HOT 2
- SyntaxError: invalid syntax HOT 7
- Offline reading HOT 9
- x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timesearch.