Home > OS >  webdriver opera, ValueError: API Rate limit exceeded. You have to add GH_TOKEN
webdriver opera, ValueError: API Rate limit exceeded. You have to add GH_TOKEN

Time:06-05

guys!!! I have a problem, I'm trying to access whatsapp with webdriver and in the browser opera, but the error appears

ValueError: API rate limit exceeded. You have to add GH_TOKEN!!!

I googled https://github.com/SergeyPirogov/webdriver_manager/blob/master/README.md#use-with-opera

But I didn't find the solution. In Google Chrome works.

enter image description here

CodePudding user response:

Errors are caused by not using a GH_TOKEN and the API timing out (max 60 requests/hr for unauthenticated users.

The webdriver_manager docs outline the potential issues you have ran into here.

https://github.com/SergeyPirogov/webdriver_manager#configuration

I ran into similar issues but whilst attempting to run this as apart of a Github Action. It all ran fine locally, and ran fine a few times as a part of the Github Action, but eventually stopped working.


This can be fixed by adjusting your .github/workflows/ACTION.yml file (noting the .yml file can be called whatever you like).

name: Your Github Action

on:
  schedule:
    - cron: '0 3 * * 2'
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning' 
        type: choice
        options:
        - info
        - warning
        - debug 

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - uses: actions/labeler@v2
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
    
    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
        
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        
    - name: Run Your webdriver based task
      env:
        # This is the important line to add
        GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: python script.py

The 2nd last line here is the important part. You can use the standard GITHUB_TOKEN environment variable that is exposed by default to your Github Action. Or you can choose to setup your own, if you want.

CodePudding user response:

Try to use ChromeDriver instead of Geckodriver. It worked for me.

  • Related