sportnews-api


Namesportnews-api JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/votre-username/sportnews-sdk
SummaryOfficial Python SDK for the SportNews API - Access sports news in real time
upload_time2024-12-02 01:36:41
maintainerNone
docs_urlNone
authorStefen
requires_python>=3.9
licenseNone
keywords sports news api sdk actualités sportives
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# SportNews API SDK

An official Python SDK for the SportNews API, providing streamlined access to real-time sports news. This library allows developers to easily integrate sports news feeds into their Python applications.

## Installation

```bash
pip install sportnews-api
```

## Usage

```python
from sportnews import SportNewsAPI

# Initialize the client with your API key
api = SportNewsAPI('YOUR_API_KEY')

# Retrieve the latest news
articles = api.get_news(language='fr', size=5)

print("Dernières actualités :")
if articles['items']:
    for article in articles['items']:
        print(f"Titre: {article['title']}")
        print(f"Date: {article['published']}")
        print(f"Description: {article['description']}")
        print(f"Sport: {article['sport']}")
        print("---")
else:
    print("Aucun article trouvé")
```

### Searching for Articles

```python
# Search for articles about football from the last 7 days

results = api.search_news(
    query="Champions League",
    sport="football",
    language="en",
    size=10
)

if results['items']:
    for article in results['items']:
        print(f"Titre: {article['title']}")
        print(f"Date: {article['published']}")
        print(f"Description: {article['description']}")
        print(f"Sport: {article['sport']}")
        print("---")
else:
    print("Aucun résultat trouvé")
```

## Key Features

- Retrieve the latest sports news
- Search articles with advanced filters
- Multilingual support (FR, EN, ES, IT, DE)
- Pagination of results
- Robust error handling
- Automatic parameter validation
- Date-based search for temporal filtering

## NewsArticle Object

Each news article returned by the API has the following attributes:
- `title` (str): The title of the article.
- `published` (datetime): The publication date.
- `description` (str): A brief summary of the article.
- `sport` (str): The sport associated with the article.
- `language` (str): The language of the article.

## Error Handling

The SDK raises a `SportNewsAPIError` for any issues during API requests. Make sure to handle these exceptions in your application:

```python
from sportnews import SportNewsAPI, SportNewsAPIError

try:
    news = api.get_latest_news(language='fr')
except SportNewsAPIError as e:
    print(f"An error occurred: {e}")
```

## Supported Languages

- French (`fr`)
- English (`en`)
- Spanish (`es`)
- Italian (`it`)
- German (`de`)

## License

This project is licensed under the MIT License.

## Running Tests

The SDK includes a suite of unit tests to validate its functionality. Run the following command to execute the tests:

```bash
python -m unittest discover tests
```

## Support

- Documentation: [https://docs.sportnews-api.com](https://docs.sportnews-api.com)
- Support email: support@sportnews-api.com

Developed and maintained by the SportNews API team.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/votre-username/sportnews-sdk",
    "name": "sportnews-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "sports news api sdk actualit\u00e9s sportives",
    "author": "Stefen",
    "author_email": "votre.email@domain.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/a2/7645cf57a0865c8318aabdffe5f09a02fd9a57c319b40001eec3f15509e7/sportnews_api-0.1.8.tar.gz",
    "platform": null,
    "description": "\n# SportNews API SDK\n\nAn official Python SDK for the SportNews API, providing streamlined access to real-time sports news. This library allows developers to easily integrate sports news feeds into their Python applications.\n\n## Installation\n\n```bash\npip install sportnews-api\n```\n\n## Usage\n\n```python\nfrom sportnews import SportNewsAPI\n\n# Initialize the client with your API key\napi = SportNewsAPI('YOUR_API_KEY')\n\n# Retrieve the latest news\narticles = api.get_news(language='fr', size=5)\n\nprint(\"Derni\u00e8res actualit\u00e9s :\")\nif articles['items']:\n    for article in articles['items']:\n        print(f\"Titre: {article['title']}\")\n        print(f\"Date: {article['published']}\")\n        print(f\"Description: {article['description']}\")\n        print(f\"Sport: {article['sport']}\")\n        print(\"---\")\nelse:\n    print(\"Aucun article trouv\u00e9\")\n```\n\n### Searching for Articles\n\n```python\n# Search for articles about football from the last 7 days\n\nresults = api.search_news(\n    query=\"Champions League\",\n    sport=\"football\",\n    language=\"en\",\n    size=10\n)\n\nif results['items']:\n    for article in results['items']:\n        print(f\"Titre: {article['title']}\")\n        print(f\"Date: {article['published']}\")\n        print(f\"Description: {article['description']}\")\n        print(f\"Sport: {article['sport']}\")\n        print(\"---\")\nelse:\n    print(\"Aucun r\u00e9sultat trouv\u00e9\")\n```\n\n## Key Features\n\n- Retrieve the latest sports news\n- Search articles with advanced filters\n- Multilingual support (FR, EN, ES, IT, DE)\n- Pagination of results\n- Robust error handling\n- Automatic parameter validation\n- Date-based search for temporal filtering\n\n## NewsArticle Object\n\nEach news article returned by the API has the following attributes:\n- `title` (str): The title of the article.\n- `published` (datetime): The publication date.\n- `description` (str): A brief summary of the article.\n- `sport` (str): The sport associated with the article.\n- `language` (str): The language of the article.\n\n## Error Handling\n\nThe SDK raises a `SportNewsAPIError` for any issues during API requests. Make sure to handle these exceptions in your application:\n\n```python\nfrom sportnews import SportNewsAPI, SportNewsAPIError\n\ntry:\n    news = api.get_latest_news(language='fr')\nexcept SportNewsAPIError as e:\n    print(f\"An error occurred: {e}\")\n```\n\n## Supported Languages\n\n- French (`fr`)\n- English (`en`)\n- Spanish (`es`)\n- Italian (`it`)\n- German (`de`)\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Running Tests\n\nThe SDK includes a suite of unit tests to validate its functionality. Run the following command to execute the tests:\n\n```bash\npython -m unittest discover tests\n```\n\n## Support\n\n- Documentation: [https://docs.sportnews-api.com](https://docs.sportnews-api.com)\n- Support email: support@sportnews-api.com\n\nDeveloped and maintained by the SportNews API team.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Official Python SDK for the SportNews API - Access sports news in real time",
    "version": "0.1.8",
    "project_urls": {
        "Documentation": "https://docs.sportnews-api.com",
        "Homepage": "https://github.com/votre-username/sportnews-sdk",
        "Source": "https://github.com/votre-username/sportnews-sdk"
    },
    "split_keywords": [
        "sports",
        "news",
        "api",
        "sdk",
        "actualit\u00e9s",
        "sportives"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c6c4ae80a652f97bf39fa7a4b822cd63e5a16b1adc5b3b09e09cb02d68857b1",
                "md5": "80309ee2e574d4f9805204048aa63269",
                "sha256": "c83a37cf638577d3b3a41ef8ae83944754408ffa7dfea74b31e5193267287790"
            },
            "downloads": -1,
            "filename": "sportnews_api-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "80309ee2e574d4f9805204048aa63269",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5843,
            "upload_time": "2024-12-02T01:36:39",
            "upload_time_iso_8601": "2024-12-02T01:36:39.984849Z",
            "url": "https://files.pythonhosted.org/packages/0c/6c/4ae80a652f97bf39fa7a4b822cd63e5a16b1adc5b3b09e09cb02d68857b1/sportnews_api-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2a27645cf57a0865c8318aabdffe5f09a02fd9a57c319b40001eec3f15509e7",
                "md5": "24c1a3e4ac255d9aa88d3c1a966054d8",
                "sha256": "0d6bfebb0542c90f8ca5bf90e057207ca86c0dcf15146a647f80452c4d7f8ff4"
            },
            "downloads": -1,
            "filename": "sportnews_api-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "24c1a3e4ac255d9aa88d3c1a966054d8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7012,
            "upload_time": "2024-12-02T01:36:41",
            "upload_time_iso_8601": "2024-12-02T01:36:41.518194Z",
            "url": "https://files.pythonhosted.org/packages/d2/a2/7645cf57a0865c8318aabdffe5f09a02fd9a57c319b40001eec3f15509e7/sportnews_api-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 01:36:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "votre-username",
    "github_project": "sportnews-sdk",
    "github_not_found": true,
    "lcname": "sportnews-api"
}
        
Elapsed time: 0.43854s