<commit_before>package MediaWords::Util::Facebook;

#
# Facebook API helper
#

use strict;
use warnings;

use MediaWords::CommonLibs;

use MediaWords::Util::Config;
use MediaWords::Util::JSON;
use MediaWords::Util::Process;
use MediaWords::Util::URL;
use MediaWords::Util::Web;

use Readonly;
use URI::QueryParam;
use Data::Dumper;
use List::MoreUtils qw/any/;

# Facebook Graph API version to use
Readonly my $FACEBOOK_GRAPH_API_VERSION => 'v2.8';

# Number of retries to do on temporary Facebook Graph API errors (such as rate limiting issues or API downtime)
Readonly my $FACEBOOK_GRAPH_API_RETRY_COUNT => 22;

# Time to wait (in seconds) between retries on temporary Facebook Graph API errors
Readonly my $FACEBOOK_GRAPH_API_RETRY_WAIT => 10 * 60;

# Facebook Graph API's error codes of temporary errors on which we should retry
# after waiting for a while
#
# (https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#errors)<commit_msg>add missing module to Facebook.pm<commit_after>package MediaWords::Util::Facebook;

#
# Facebook API helper
#

use strict;
use warnings;

use MediaWords::CommonLibs;

use MediaWords::Util::Config;
use MediaWords::Util::JSON;
use MediaWords::Util::Process;
use MediaWords::Util::URL;
use MediaWords::Util::Web;

use Readonly;

use URI;
use URI::QueryParam;
use Data::Dumper;
use List::MoreUtils qw/any/;

# Facebook Graph API version to use
Readonly my $FACEBOOK_GRAPH_API_VERSION => 'v2.8';

# Number of retries to do on temporary Facebook Graph API errors (such as rate limiting issues or API downtime)
Readonly my $FACEBOOK_GRAPH_API_RETRY_COUNT => 22;

# Time to wait (in seconds) between retries on temporary Facebook Graph API errors
Readonly my $FACEBOOK_GRAPH_API_RETRY_WAIT => 10 * 60;

# Facebook Graph API's error codes of temporary errors on which we should retry
# after waiting for a while
#
# (https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#errors)
{'fraction_non_alphanumeric': 0.1012396694214876, 'fraction_numerical': 0.010330578512396695, 'mean_word_length': 5.84452296819788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1662199', 'n_tokens_mistral': 648, 'n_tokens_neox': 610, 'n_words': 205}