mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #108] Run a spotipy script as cronjob on a Raspberry Pi (OAuth problem) #51
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mymindwentblvnk on GitHub (Jul 27, 2016).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/108
Hi,
I tried to run my spotipy based python script on the Raspberry Pi. It won't work.
In the logs you will find the request for a new OAuth token ("... Paste that url you were directed to to complete the authorization.").
The spotipy cache file is also in the directory. The script works as long as I will not run it via CRON.
I cannot see how to solve this. Can somebody help me?
Greetings, michael
@thedangler commented on GitHub (Aug 10, 2016):
I'm running into the same problem, it keeps asking me to authenticate even though I have. It's as if it doesn't get the cached token.
@mymindwentblvnk commented on GitHub (Aug 10, 2016):
Does cron run with its own user?
@grlindburg commented on GitHub (Aug 10, 2016):
I believe cron runs as root. I set this up so that I'm cd'ing to the appropriate directory within cron before executing my spotipy script. Something like:
0 * * * * cd /env && /env/spotipy_script.py >> spotipy.logSeems to work just fine for me since my appkey is also within this directory.
@thedangler commented on GitHub (Aug 10, 2016):
Mine is working now, I was a moron and put , in between my scopes instead of leaving a space.
However, when I provide the full callback url it never works, If I provide ?code=.... it works. But I think it a pycharm console issue.
@mymindwentblvnk commented on GitHub (Aug 16, 2016):
Thanks @grlindburg
This worked for me too. My crontab task (every night at 0:24 AM)
24 0 * * * cd /home/pi/scripts/SpotifyNotificationTweeter && python3.4 main.py > /home/pi/snt.txt