Skip to main content

yahoo_oauth_fantasy

Yahoo_OAuth_Fantasy is a very easy to use OAuth library for Yahoo! Fantasy APIs. (Based on https://github.com/josuebrunel/yahoo-oauth)

Installation

pip install yahoo_oauth_fantasy

Quickstart

Wether you use OAuth1 or OAuth2, only 2 parameters are required.

  • *consumer*key_

  • *consumer*secret_

You have two choices, you can either put those two into a file from_file. Only *json* and *yaml* files are supported

{
    "consumer_key": "my_very_long_and_weird_consumer_key",
    "consumer_secret": "my_not_that_long_consumer_secret"
}

or have them as a string variable from_string

cred_string = '{"consumer_key": "my_very_long_and_weird_consumer_key","consumer_secret": "my_not_that_long_consumer_secret"}'

Once you acquired your access_token, if you are using a file, it will save under the same name, and look like:

  • OAuth1

{
    "access_token": "A=5ZnN5xXY5yKacQp1QtUF68MlEmXVIF8fRplkc7W1QMVYeLJ2DdBmNyH7SxVgUbAjdv5edCnk_DEUbfr6GpqezsSAuE9h36wfh.J45twIo1sA.bqMk7Bta6IisI9z1_h8D0QZzWYmjybxlQcuNgd7TY4nJuu_Afj_8ED787BQbjg6OqRotV.eM4_YyBCjP1K8G6rG44iX2PGNj.JSEJrocgvglABkTTVA_8t.JoLH7NHSgxCQXhakBsk3_K.6Rkgm_Nkc7.ZD02pYy3dJAfBh1fFvtrCwIOqDIplri305dZ1UY430X6SfPnZIFJNiTWkMH8_QRhcnfizG5TZugN_.0ib2VnnUzspeFT0_86p6WMP3uFOLYXspdEOryhSJwFJ3AHZN9n.t8euRQOxanpsvw5M5ffBs6P0dI5FijGw3fibbqoheJOSUE_BRUNEL_KOUKAJSsJCH(^_^)JHllHmJUptK9k5ifiqJOpTbodnW8EsyyNhthDOusv5Bp6142mvCPnC7HX7PkTodHqfgVyAUOvOqSsqMGyc65OY8roLORKpUWObw9bjd8YsU40jwSaGZtWmvVhYV9RxUA779bRuE1k0BL_fvXQ_tlZnxPhtIFBB64szQ9AwA9HT_nZKq8q1rOfUcBIZJ7Zu1jwpZUAOkHsfmHWCW2gK8BC4wjk0WuJg95FpZ2z741mhRcdma2bVYpdh3k2DdaBVYRTDT36Q4SBtreb_GNi1Mctg.RhSqopCTTvW4jjXAkt2SHnscUi37v0yo4JVex0cnVmVTFL7TRl1JMLl9jt0XmaLaKuS4nhR4A--",
    "access_token_secret": "99a20a82e99THE_A_Tf803cb153f3d98",
    "consumer_key": "dj0yJmk9e_THIS_IS_THE_CK_RGTnpZbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iNQ--",
    "consumer_secret": "08802b459abTHIS_IS_THE_CS4b75789f7",
    "guid": "AJHDHJMYGUID",
    "session_handle": "APIENFXij.bjFW_MY_SESSION_EXn.4.DOIYOR37",
    "token_time": 1433546792.343515
}
  • OAuth2

{
    "access_token": "DELvMgOYvwPQJS8eFW_2hRN5rJxz6dnHAOk2s.qB0iMIeRg5.ZpW3xZF0p8CABLjZ2gfNdE602dCN2wTHdGHHLtChF3ls9BUuZ1QDdqIVq.yWclfweleyZSq6dAzlPEHiskWmfItjHK5VERY_LONG_ACCESS_TOKEN_oyyD4cIKvdNJsJ9k779mAUqN02_5ugBeDfCLebqjL8uVuunObew0ERa2MxE6jywNY0TTCe9W0nqTd6n0lKoN4PSP1Dw_Ifwx6enGuhUUAhhpa7nNMyhNy_pe6PfDf7IJ5gbkdtw3mD1o2T218ZTV0owdrKDLSF9oZrNvZ75xDlqaaI5yeW_.L63zk11PjsWUd5K8LGhWSTgRbyhffCDBcqVwTYEqHwCyVqHX4z2kgHhGsc0ies6WMG33kSw5Cgun0fnPbdDuHBgQziXU.GMv4hIDoIDMSLGpzpcpkyx4GS1CC_RUQwKxLilR3MQy7X2gI3cJA4lhRPlXEOdhS5HIQiQTgMWO9nWt7.RR7XtXVg-",
    "consumer_key": "dj0yJmk9eFJINERDYWMY_CONSUMER_KEYmRGTnpZbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iNQ--",
    "consumer_secret": "08802b459ab48eeaMY_CONSUMER_SECRET_0af6a4b75789f7",
    "guid": "AJHDHJMYGUID",
    "refresh_token": "APIENFXij.bjFW1tEcr2THE_REFRESH_TOKEN_Xn.4.DOIYOR37",
    "token_time": 1433553339.706037,
    "token_type": "bearer"
}

If you are using a string, you can call get_new_data to get a string with the information shown above.

With that you should be good to go.

Normally, once your got all that, you can *use the same credentials FOREVER*, you just have to *REFRESH THEM*.

Examples

OAuth1

from yahoo_oauth import OAuth1
oauth = OAuth1(None, None, from_file='oauth1.json')
...

if not oauth.token_is_valid():
    oauth.refresh_access_token()

# Example
response = oauth.session.post(url, data=body)

OAuth2

from yahoo_oauth import OAuth2
oauth = OAuth2(None, None, from_file='oauth2.json')
...

if not oauth.token_is_valid():
    oauth.refresh_access_token()
# Example
response = oauth.session.get(url, params=payload)

OAuth2 from String

from yahoo_oauth import OAuth2
cred_string = '{"consumer_key": "my_very_long_and_weird_consumer_key","consumer_secret": "my_not_that_long_consumer_secret"}'
oauth = OAuth2(None, None, from_string=cred_string)
...

if not oauth.token_is_valid():
    oauth.refresh_access_token()
new_cred_string = oauth.get_new_data()
# Example
response = oauth.session.get(url, params=payload)

Tips

  • How to get your Global Unique Identifier (GUID) ```python from yahoo_oauth import OAuth2

oauth = OAuth2(‘consumer_key’, ‘consumer_secret’) guid = oauth.guid

```

  • How to disable Yahoo_OAuth Logger

    import logging
    oauth_logger = logging.getLogger('yahoo_oauth')
    oauth_logger.disabled = True

Contribute

Any kind of contribution is welcomed.

  1. report bug by opening an issue

  2. Fork the repository

  3. Make your changes

  4. Test your changes

  5. Submit a pull request

Let me know if any more updates are needed!

Metadata

Release files for yahoo-oauth-fantasy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yahoo-oauth-fantasy 0.1.0
File Size Uploaded Provenance Actions
yahoo_oauth_fantasy-0.1.0.tar.gz 10.0 kB Without provenance Details for yahoo_oauth_fantasy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yahoo-oauth-fantasy 0.1.0
File Interpreter ABI Platform Actions
yahoo_oauth_fantasy-0.1.0-py3-none-any.whl Python 3 none any Details for yahoo_oauth_fantasy-0.1.0-py3-none-any.whl

Total release size: 17.8 kB

Release files / yahoo_oauth_fantasy-0.1.0.tar.gz

Download URL yahoo_oauth_fantasy-0.1.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
87537c55b3b2fe939a756a1e40e1fa6f5888fbd061c9a6b38faee99584123097
BLAKE2b-256 checksum
How to use checksums
a6bddd98e1a9c55d053a2a7eb36f524a10eda0e0ff8844146841388a948fb35d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

Release files / yahoo_oauth_fantasy-0.1.0-py3-none-any.whl

Download URL yahoo_oauth_fantasy-0.1.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cac9bd1820d3722aecf3b54cd82b0821447856a54c4d7bc77fc019e78371b2e
BLAKE2b-256 checksum
How to use checksums
48cfc9aa1f44fb1412d16aaadf727c1abe53cb89bc99d468ec10f76672ddb0ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

Security for yahoo-oauth-fantasy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page