I think I used the code correctly, but I'm getting a name error. How to solve it?
CodePudding user response:
You didnt declared token variable. You have to declare some value before save_tokens(KaKAO_TOKEN_FILENAME, tokens). You cant basically get variable if you declared it in a function beacause variables declared in a def function like update_tokens are private. So line before save_tokens(KaKAO_TOKEN_FILENAME, tokens).
set tokens = your value
for example:
...code...
tokens = 'your token'
save_tokens(KAKAO_TOKEN_FILENAME, tokens)
If you are beginner, and want to use api of this website, then i recommend watching some videos about ex. api with python
. In most cases to get token, go find api documentation on this site and search for token. The token somethimes is not free or has limited uses ex. per day.