Comments (7)
Hi, thanks for bringing this to my attention. I generally prefer to maintain authorship instead of doing pull requests.
If /meta is gone for good, we don't need the initialize function at all any more -- we'll just define ratelimit
at the top of the file with a constant value.
Sounds like we're doing this:
DEFAULT_PARAMS = {
'size': 1000,
- 'sort': 'asc',
- 'sort_type': 'created_utc',
+ 'order': 'asc',
+ 'sort': 'created_utc',
}
session.headers.update({'User-Agent': useragent})
+ratelimit = ratelimiter.Ratelimiter(allowance=120, period=60)
class DummyObject:
-def _initialize_ratelimiter():
- global ratelimit
- if ratelimit is not None:
- return
- log.debug('Initializing pushshift ratelimiter.')
- url = 'https://api.pushshift.io/meta'
- response = session.get(url)
- response.raise_for_status()
- response = response.json()
- limit = response['server_ratelimit_per_minute']
- log.debug('Pushshift ratelimit is %d requests per minute.', limit)
- ratelimit = ratelimiter.Ratelimiter(allowance=limit, period=60)
def get(url, params=None):
- _initialize_ratelimiter()
if not url.startswith('https://'):
url = API_URL + url.lstrip('/')
But I'm getting 500-level errors from all of api.pushshift.io so I can't test or read their new docs just yet.
from timesearch.
I made the changes and tested them and everything is working for me. Thanks @voussoir and @RaedShabbir! I am still getting 524 errors, but it sounds like these have something to do with the move to the COLO and they are working on resolving them. That being said, given enough time, all of my scripts are running. Thanks!
from timesearch.
Closed by 2c0ae72, thank you
from timesearch.
Update:
https://www.reddit.com/r/pushshift/comments/zhzaea/the_day_has_finally_arrived_pushshift_api_move/
So i think this is to be expected for a bit.
from timesearch.
Update requires minor change in pushshift.py, "sort"->"order" and "sort_type"->"sort". Will share a PR once I have it fully working.
from timesearch.
@RaedShabbir Curious the status on your changes?
I am sorting through the required changes myself at the moment. It sounds like https://api.pushshift.io/meta will no longer be available. Or did I misread? Do you know if there is a new URL? Or does the def _initialize_ratelimiter() need to be rewritten?
from timesearch.
In addition to the sort and order changes above, I had to update def _initialize_ratelimiter(). Not sure if this is the best solution or not. I ended up removing most of the code in def _initialize_ratelimiter(), including the url call to https://api.pushshift.io/meta.
The new def _initialize_ratelimiter() looks like this:
def _initialize_ratelimiter():
global ratelimit
ratelimit = ratelimiter.Ratelimiter(allowance=120, period=60)
It seems to be working.
I cannot figure out how to get a dynamic rate limit from pushshift itself.
from timesearch.
Related Issues (19)
- Proxy HOT 6
- 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
- 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.