Code Monkey home page Code Monkey logo

naijabet_api's Introduction

Hi there ๐Ÿ‘‹

Alao Adedamola Taiwo

Contact

LinkedIn Profile Email GitHub Profile

Navigation

Projects | Skills | Education | Interest

Projects

Project/GitHub Details Tech Additional Links
Tassel An Android app for saving and syncing bookmarks across devices(wip) Android, Kotlin, Jetpack Compos Github
FindHealth A collaborative project: An android app that helps to find the closest available healthcare facility. Android, Kotlin, Google Maps, Room, DataBinding. Github

Technical Knowledge

Visual Studio Code

Kotlin

HTML5

CSS3

JavaScript

React

GraphQL

Node.js

MongoDB

MySQL

Android

Firebase

Git

GitHub

Linux

naijabet_api's People

Contributors

jayteealao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

naijabet_api's Issues

Updates needed to API.

Issue1: The Nairabet link is invalid or no more works.
That the error you get
2023-05-18 18:14:14,374 - bookmakers.BaseClass - ERROR - HTTP error occurred: 404 Client Error: Not Found for url: https://www.nairabet.com/rest/market/categories/multi/135763/events 2023-05-18 18:14:14,374 - bookmakers.BaseClass - ERROR - Response content: b"<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message></Error>"
It needs to be updated.

Issue 2:
The .json normalizer files need some updates with the new style of teams on each site. I added a logger to get the teams that are missing.
Olympique Marseille not found in betking_normalizer.json normalizer Stade Brest 29 not found in betking_normalizer.json normalizer RC Lens not found in betking_normalizer.json normalizer AC Ajaccio not found in betking_normalizer.json normalizer Stade Rennes not found in betking_normalizer.json normalizer

If you can add the other betting sites. that will be nice.

Some of my updated version of your code if it helps normalizer.py

`import json
import re
from typing import ChainMap
import arrow
from pathlib import Path
import difflib
from utils.logger import get_logger

logger = get_logger(__name__)


def match_normalizer(list, pathstr: str):
    path = Path(__file__).parent / pathstr
    if list is None:
        return {}
    data = list[:]

    def helper(string):
        with open(path, "r") as f:
            normalizer = json.load(f)
            try:
                return normalizer[string]
            except KeyError:
                logger.warning(f"{string} not found in {pathstr} normalizer")
                path_b9 = Path(__file__).parent / "bet9ja_normalizer.json"
                path_bk = Path(__file__).parent / "betking_normalizer.json"
                path_nb = Path(__file__).parent / "nairabet_normalizer.json"

                map = ChainMap(
                    json.load(open(path_b9, "r")),
                    json.load(open(path_bk, "r")),
                    json.load(open(path_nb, "r")))
                try:
                    return map[string]
                except KeyError:
                    logger.warning(f"{string} not found in normalizer")
                    res = difflib.get_close_matches(string, map.keys(), 1, 0.8)
                    if res:
                        logger.warning(f'found possible matches {res}')
                        return map[res[0]]
                    else:
                        logger.warning(f"No close match found for {string}")
                        return string  # Return the original string if no match is found

    for event in data:
        teams = event["match"]
        home, away = re.split(r"\s-\s", teams, maxsplit=1)
        home = helper(home.strip())
        away = helper(away.strip())
        event["match"] = "{0} - {1}".format(home, away)
        event["time"] = arrow.get(event["time"]).int_timestamp
        event['league'] = helper(event['league'])

    return data

def bet9ja_match_normalizer(list):
    return match_normalizer(list, "bet9ja_normalizer.json")

def nairabet_match_normalizer(list):
    return match_normalizer(list, "nairabet_normalizer.json")

def betking_match_normalizer(list):
    return match_normalizer(list, "betking_normalizer.json")

`

Installation

I successfully installed this package but I tried to import the script as shown in the docs but the import was not successful

Need to Contact You

Hello @jayteealao, how does one reach you? Please do let me know. My email and other contacts are on my profile. Thanks.

Sorry I had to do it this way, but I couldn't find a way to reach you from your profile.

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.