[ENG/ITA] After a Small Stop, Megaptera-marina is Working Again

avatar


La versione italiana si trova sotto quella inglese

The italian version is under the english one


After a Small Stop, Megaptera-marina is Working Again

@megaptera-marina is the account I use to reblog posts participating in the #untobisunto contest, which is held weekly in the Olio di Balena Community and offers great prizes (100 HIVE up for grabs for the winners each week).



Here you can find this week’s active contest

In addition to reblogging, allowing those who follow the account to easily find the participants’ posts, @megaptera-marina also leaves an informative comment under each post, sharing some interesting facts related to the contest.

Everything is powered by a Python script I wrote, which handles all phases — from identifying the posts to reblog and comment on, to collecting and storing the data needed to write the comments.

The script is simple and is mainly based on an API request that allows it to find the posts to reblog and comment on.


Unexpected issues

Despite its simple operation, about a week ago I started receiving notifications warning me that the script was failing to complete its task.

After months of working flawlessly, that caught me by surprise — and when I looked into it, I quickly realized the problem wasn’t with my script (which I hadn’t modified at all) but with the API call itself.

Apparently, about ten days ago a new limit was introduced that prevents retrieving more than 20 posts per call. My configuration was set to fetch 100 posts at a time, which obviously caused an issue...

... fortunately, the fix was easy: I just had to reduce the number of posts retrieved per call — represented by the "limit" key — from 100 to 20.

data = (
    f'{{"jsonrpc":"2.0", "method":"bridge.get_ranked_posts", '
    f'"params":{{"sort":"created","tag":"hive-146620","observer":"", '
    f'"limit": 20, "start_author":"{author}", "start_permlink":"{permlink}"}}, '
    f'"id":1}}'
)

Since my script runs in a loop and continues until it has analyzed all the latest posts, using pagination to gradually fetch older ones, this adjustment didn’t require me to change anything else.

That’s lucky, because who knows when I would’ve found the time to fix it otherwise 😅

This way, the script went back to working normally...



...resuming its small support activity for the #untobisunto contest!


cover image made with Bing AI

to support the #OliodiBalena community, @balaenoptera is 3% beneficiary of this post


If you've read this far, thank you! If you want to leave an upvote, a reblog, a follow, a comment... well, any sign of life is really much appreciated!


Versione italiana

Italian version


Dopo una Piccola Pausa, Megaptera-marina è di Nuovo in Funzione

@megaptera-marina è l'account che utilizzo per effettuare il reblog dei post partecipanti al contest #untobisunto, che si tiene settimanalmente nella Community Olio di Balena e consente di vincere dei bei premi (100 HIVE in palio per i vincitori ogni settimana).



Qui trovate il contest attivo questa settimana

@megaptera-marina, oltre ad effettuare il reblog, consentendo così a chi segue l'account di trovare facilmente i post dei partecipanti, lascia anche un commento informativo sotto ogni post, raccontando alcuni fatti particolari inerenti al contest.

Il tutto è mosso da un mio script in Python, che si occupa di gestire tutte le fasi, dalla individuazione dei post, al reblog e commento, alla raccolta e conservazione dei dati necessari per scrivere i commenti.

Lo script è semplice e si basa principalmente su una richiesta API che gli consente di trovare i post da rebloggare e commentare.


Problemi imprevisti

Nonostante un funzionamento semplice, però, circa una settimana fa ho cominciato a ricevere notifiche che mi avvisano che lo script non stava riuscendo a completare il proprio lavoro.

Dopo mesi di corretto funzionamento ciò mi ha un po' sorpreso e, quando sono andato ad indagare su cosa fosse successo, ho presto capito che il problema non era infatti nel mio script - a cui non avevo apportato alcuna modifica - ma nella chiamata API.

In particolare, una decina di giorni fa deve essere stato introdotto un limite per cui con ogni singola chiamata non è possibile recuperare più di 20 post alla volta: la mia configurazione preveda di recuperarne 100 e questo, ovviamente, andava a creare un problema...

... per fortuna la soluzione è stata facile: mi è bastato abbassare il numero di post recuperati ad ogni chiamata - rappresentati dalla chiave "limit" - da 100 a 20.


 data = (
            f'{{"jsonrpc":"2.0", "method":"bridge.get_ranked_posts", '
            f'"params":{{"sort":"created","tag":"hive-146620","observer":"", '
            f'"limit": 20, "start_author":"{author}", "start_permlink":"{permlink}"}}, '
            f'"id":1}}'
        )

Dato che il mio script funziona in loop e va avanti fintanto che non ha analizzato tutti i post più recenti, sfruttando il sistema di paginazione per recuperare via via post sempre più vecchi, apportare questa modifica non mi ha richiesto di dover adattare nient'altro.

Il che è una fortuna perchè se no chissà quando avrei trovato il tempo per farlo 😅

Così invece lo script ha ripreso a funzionare normalmente...



... riprendendo la sua piccola attività di supporto al contest #untobisunto!


immagine di cover creata con Bing AI

a supporto della community #OliodiBalena, il 3% delle ricompense di questo post va a @balaenoptera

Se sei arrivato a leggere fin qui, grazie! Se hai voglia di lasciare un upvote, un reblog, un follow, un commento... be', un qualsiasi segnale di vita, in realtà, è molto apprezzato!

Posted Using INLEO



0
0
0.000
2 comments
avatar

Che bello quando cambiano cose a cazzo senza avvisare nessuno in modo arbitrario 😂

0
0
0.000
avatar

Congratulations @arc7icwolf! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You got more than 25000 replies.
Your next target is to reach 25500 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

0
0
0.000