GithubHelp home page GithubHelp logo

Comments (7)

voussoir avatar voussoir commented on May 30, 2024 3

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.

rickcecil avatar rickcecil commented on May 30, 2024 1

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.

voussoir avatar voussoir commented on May 30, 2024 1

Closed by 2c0ae72, thank you

from timesearch.

RaedShabbir avatar RaedShabbir commented on May 30, 2024

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.

RaedShabbir avatar RaedShabbir commented on May 30, 2024

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.

rickcecil avatar rickcecil commented on May 30, 2024

@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.

rickcecil avatar rickcecil commented on May 30, 2024

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)

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.