-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Ossapi.__init__() got an unexpected keyword argument 'headers' #57
Comments
ossapi doesn't require a custom user agent and has no api = ossapi.Ossapi(api_key) I'm not sure why you're specifying a user agent, but you don't have to for the osu! api. |
If you're using ossapi v3.0.0 or later (which it seems like you are), then the v1 version of ossapi is called api = ossapi.OssapiV1(api_key) If you want to use v2 of the api, you'll have to follow the instructions here to create an ouath client: https://circleguard.github.io/ossapi/creating-a-client.html. |
File "c:\Users\arthu\Codes\import osuapi.py", line 14, in Sorry for troubling, but this error happened. What item is outside the index range? |
what is |
Oh, I didn't know there was two types of ID, thank you! |
I'm trying to get information from a beatmap using my api key, but this error keeps happening, what I'm doing wrong?
import ossapi
Replace "YOUR_API_KEY" with your own API key
api_key = "My api key"
Create a dictionary of headers to set the user agent
headers = {"User-Agent": "MyAwesomeApp/1.0"}
Create an Ossapi object using your API key and headers
api = ossapi.Ossapi(api_key, headers=headers)
Replace "BEATMAP_ID" with the ID of the beatmap you want to get information for
beatmap_id = "1514385"
Get the beatmap information using the get_beatmaps method
The method returns a list of beatmap objects, so we access the first item in the list
beatmap = api.get_beatmaps(beatmap_id=beatmap_id)[0]
Open a text file for writing
filename = f"{beatmap_id}.txt" # Use the beatmap ID as the filename
with open(filename, "w") as f:
print(f"Beatmap information written to {filename}")
The text was updated successfully, but these errors were encountered: