9
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]

I'm getting rate_limit_error on the API when posting posts with just title+url. What is the default rate limit for posts? Do all requests have a rate limit or only posts?

Can I get the rate limit from an instance with a request to the API?

Edit:

{
  "local_site_rate_limit": {
    "id": 1,
    "local_site_id": 1,
    "message": 180,
    "message_per_second": 60,
    "post": 6,
    "post_per_second": 600,
    "register": 3,
    "register_per_second": 3600,
    "image": 6,
    "image_per_second": 3600,
    "comment": 6,
    "comment_per_second": 600,
    "search": 60,
    "search_per_second": 600,
    "published": "2023-02-05T03:52:36.832982"
  }
}

I'm getting limit rate with a 10 second delay so 1/post_per_second = 0,0016 seconds / post delay is not right. So what do those even mean and what is the delay I should have between posts?

1
submitted 2 years ago by [email protected] to c/[email protected]
1
submitted 2 years ago by [email protected] to c/[email protected]
1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
1
submitted 2 years ago by [email protected] to c/[email protected]
1
submitted 2 years ago by [email protected] to c/[email protected]
1
submitted 2 years ago by [email protected] to c/[email protected]
10
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]

Mainstream media is often accused of being a government propaganda tool, and there are many things they would never show. I've thought about this after seeing the clip titled "You are a disgrace! Canada PM Trudeau savaged by German MEP at EU Parliament" on YouTube. Taking a quick look at YouTube, I see it's not covered by any of the popular mainstream propaganda outlets. There are probably many other clips like this that they would never show.

What are your favorite ones?

1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
1
submitted 2 years ago by [email protected] to c/[email protected]
[-] [email protected] 27 points 2 years ago

Oh yeah I was thinking more along the lines of video games or movies where there are too many people creating it. For books, etc you can definitely donate.

[-] [email protected] 53 points 2 years ago* (last edited 2 years ago)

I really like to see communities like lemmy.film, mtgzone.com, and programming.dev and wish there was an instance about literature.

[-] [email protected] 32 points 2 years ago

Edward Snowden, a former National Security Agency contractor and government whistleblower, has been credited with the quote "Arguing that you don't care about the right to privacy because you have nothing to hide is no different than saying you don't care about free speech because you have nothing to say". Snowden has argued that privacy is a fundamental right and that without it, individuals cannot have anything for themselves. The "nothing to hide" argument has been used to defend the collection and use of government data beyond surveillance and disclosure, but critics argue that it is inherently paradoxical and that what is hidden is not necessarily relevant. Snowden has also stated that the burden of justification falls on those seeking to infringe upon human rights, and that nobody needs to justify why they "need" a right.

[-] [email protected] 24 points 2 years ago* (last edited 2 years ago)

Depending on which instances are blocked you will see different content in ones or others. Which is why I choose instance based on the minimum number of blocked users based on the results of this script.

[-] [email protected] 25 points 2 years ago

I knew I recognized him from somewhere. He was the developer of lib.reviews. https://github.com/eloquence

[-] [email protected] 28 points 2 years ago* (last edited 2 years ago)

I'm still waiting for a local autonomous AI agent with search. I don't understand why most autonomous agent projects use GPT-4 without incorporating search capabilities. Allowing the model to continuously hallucinate is not productive. Instead, it should be able to discover factual information and perform genuinely useful tasks.

[-] [email protected] 26 points 2 years ago* (last edited 2 years ago)

Even if I subscribe, I'm going to have the same issue. As long as I'm subscribed to a couple of large communities, I won't see content from any of the smaller communities. Maybe when something like this gets implemented, I'll actually be able to use the subscriptions.

[-] [email protected] 29 points 2 years ago

A function decorator: You can create a decorator that handles the connection and cursor creation and passes the cursor to the decorated function.

import sqlite3
from functools import wraps

DB_FILE = "your_database_file.db"

def with_cursor(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        conn = sqlite3.connect(DB_FILE)
        cursor = conn.cursor()

        result = func(cursor, *args, **kwargs)

        conn.commit()
        cursor.close()
        conn.close()

        return result

    return wrapper

@with_cursor
def insert_post_to_db(cursor: sqlite3.Cursor, issue: Issue, lemmy_post_id: int) -> None:
    cursor.execute(
        "INSERT INTO posts (issue_url, lemmy_post_id, issue_title, issue_body) VALUES (?, ?, ?, ?)",
        (issue.url, lemmy_post_id, issue.title, issue.formatted_body),
    )
[-] [email protected] 29 points 2 years ago

A context manager: Create a context manager that handles the connection and cursor creation, as well as closing the connection when done. This way, you can use the with statement to manage the connection and cursor in your functions.

import sqlite3

DB_FILE = "your_database_file.db"

class DatabaseConnection:
    def __enter__(self):
        self.conn = sqlite3.connect(DB_FILE)
        self.cursor = self.conn.cursor()
        return self.cursor

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.conn.commit()
        self.cursor.close()
        self.conn.close()

def insert_post_to_db(issue: Issue, lemmy_post_id: int) -> None:
    with DatabaseConnection() as cursor:
        cursor.execute(
            "INSERT INTO posts (issue_url, lemmy_post_id, issue_title, issue_body) VALUES (?, ?, ?, ?)",
            (issue.url, lemmy_post_id, issue.title, issue.formatted_body),
        )
[-] [email protected] 32 points 2 years ago* (last edited 2 years ago)
> *[@username](profile_link)* said:
>
> > Original quote from the person
>
> Source: [Link to the source](source_link)

For example:

> [@[email protected]](https://lemm.ee/u/GodOfThunder) said:
>
> > How would you quote someone using CommonMark markdown syntax?
>
> [Source](https://lemm.ee/post/1063209)

Result:

@[email protected] said:

How would you quote someone using CommonMark markdown syntax?

Source

[-] [email protected] 24 points 2 years ago

I think Israel has too much of an upper hand there to ever leave. It's only a matter of time before they make smaller and cheaper drones that they can release as a swarm.

view more: next ›

GodOfThunder

0 post score
0 comment score
joined 2 years ago
MODERATOR OF