<commit_before>extern crate mm_client;

use mm_client::Client;
use mm_client::MMCError;

use client::client::APIClient;
use client::error::{ClientError, ClientResult};
use config::APIConfig;

pub struct MMClient {
    client: Client,
}

impl APIClient for MMClient {
    fn new(config: Option<&APIConfig>) -> ClientResult<MMClient> {
        config
            .ok_or(ClientError::ConfigError)
            .and_then(|conf| {
                Client::new(conf.key.as_str(), conf.secret.as_str()).or(
                    Err(
                        ClientError::InitializationError,
                    ),
                )
            })
            .and_then(|client| Ok(MMClient { client: client }))
    }

    fn url(&self, url: &str) -> ClientResult<String> {
        let mut lookup_url = String::new();
        lookup_url.push_str(url);
        lookup_url.push(if url.contains('?') { '&' } else { '?' });
        lookup_url.push_str("platform-slug");
        lookup_url.push_str("partnerplayer");

        self.client
            .url(lookup_url.as_str())
            .or_else(|err| {
                match err {
                    MMCError::ResourceNotFound => {}
                    MMCError::NotAuthorized => {}
                    _ => {
                        error!("Failed to query {} due to {}", url, err);
                    }
                };

                Err(err)
            })
            .map_err(ClientError::API)
    }
<commit_msg>DEVOPS-86 Fix bad url construction<commit_after>extern crate mm_client;

use mm_client::Client;
use mm_client::MMCError;

use client::client::APIClient;
use client::error::{ClientError, ClientResult};
use config::APIConfig;

pub struct MMClient {
    client: Client,
}

impl APIClient for MMClient {
    fn new(config: Option<&APIConfig>) -> ClientResult<MMClient> {
        config
            .ok_or(ClientError::ConfigError)
            .and_then(|conf| {
                Client::new(conf.key.as_str(), conf.secret.as_str()).or(
                    Err(
                        ClientError::InitializationError,
                    ),
                )
            })
            .and_then(|client| Ok(MMClient { client: client }))
    }

    fn url(&self, url: &str) -> ClientResult<String> {
        let mut lookup_url = String::new();
        lookup_url.push_str(url);
        lookup_url.push(if url.contains('?') { '&' } else { '?' });
        lookup_url.push_str("platform-slug");
        lookup_url.push_str("=");
        lookup_url.push_str("partnerplayer");

        self.client
            .url(lookup_url.as_str())
            .or_else(|err| {
                match err {
                    MMCError::ResourceNotFound => {}
                    MMCError::NotAuthorized => {}
                    _ => {
                        error!("Failed to query {} due to {}", url, err);
                    }
                };

                Err(err)
            })
            .map_err(ClientError::API)
    }

{'fraction_non_alphanumeric': 0.13310924369747898, 'fraction_numerical': 0.0006722689075630252, 'mean_word_length': 1.6524064171122994, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4392883', 'n_tokens_mistral': 864, 'n_tokens_neox': 839, 'n_words': 143}