Guest User

Untitled

a guest
May 22nd, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. from stravalib import Client
  2. print("Connecting to Strava")
  3. client = Client()
  4. access_token = "3*84"
  5. client.access_token = access_token
  6. athlete = client.get_athlete()
  7. print("Now authenticated for " + athlete.firstname + " " + athlete.lastname)
  8. print("For {id}, I now have an access token {token}".format(id=athlete.id, token=access_token))
  9. client.create_activity(
  10. name = 'Manual create activity Name testing Strava_API ',
  11. start_date_local = '2018-05-19T00:00:00Z',
  12. elapsed_time = 2700,
  13. distance = 1000.0,
  14. description = 'Description Name for testing Strava_API',
  15. activity_type = 'Run'
  16. )
  17.  
  18. No such attribute subscription_permissions on entity <Athlete id=3*1 firstname=A*i lastname=K*k>
  19. Now authenticated for A*i K*k
  20. For 3*1, I now have an access token 3*84
  21. Traceback (most recent call last):
  22. File "K:Egoc0d3_ownPythoncsv2strava.py", line 19, in <module>
  23. activity_type = 'Run'
  24. File "k:DistribCodingPython36libsite-packagesstravalibclient.py", line 549, in create_activity
  25. raw_activity = self.protocol.post('/activities', **params)
  26. File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 255, in post
  27. return self._request(url, params=params, files=files, method='POST', check_for_errors=check_for_errors, use_webhook_server=use_webhook_server)
  28. File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 170, in _request
  29. self._handle_protocol_error(raw)
  30. File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 215, in _handle_protocol_error
  31. raise x
  32. requests.exceptions.HTTPError: 401 Client Error: Unauthorized [Authorization Error: [{'resource': 'AccessToken', 'field': 'write_permission', 'code': 'missing'}]]]
Add Comment
Please, Sign In to add comment