'How do I fix the TypeError: __init__() got an unexpected keyword argument 'errorHandling'
I am building a League of Legends website/application for my CS capstone and I am already stuck pulling data from the API. Here is the code:
pip install pantheon
from pantheon import pantheon
import asyncio
server = "euw1"
api_key = "RGAPI-XXXXX" #(api_key is personal and shouldnt be shared)
def requestsLog(url, status, headers):
print(url)
print(status)
print(headers)
panth = pantheon.Pantheon(server, api_key, errorHandling=True, requestsLoggingFunction=requestsLog, debug=True)
async def getSummonerId(name):
try:
data = await panth.getSummonerByName(name)
return (data['id'],data['accountId'])
except Exception as e:
print(e)
async def getRecentMatchlist(accountId):
try:
data = await panth.getMatchlist(accountId, params={"endIndex":10})
return data
except Exception as e:
print(e)
async def getRecentMatches(accountId):
try:
matchlist = await getRecentMatchlist(accountId)
tasks = [panth.getMatch(match['gameId']) for match in matchlist['matches']]
return await asyncio.gather(*tasks)
except Exception as e:
print(e)
And here is the error when I run it in Visual Studio Code (Python 3.9.10 64 bit)
TypeError Traceback (most recent call last)
c:\Users\maase\Downloads\apipantheon.ipynb Cell 4' in <cell line: 12>()
9 print(status)
10 print(headers)
---> 12 panth = pantheon.Pantheon(server, api_key, errorHandling=True, requestsLoggingFunction=requestsLog, debug=True)
14 async def getSummonerId(name):
15 try:
TypeError: __init__() got an unexpected keyword argument 'errorHandling'
Do I have to import or install something to fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
