Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from stravalib import Client
- print("Connecting to Strava")
- client = Client()
- access_token = "3*84"
- client.access_token = access_token
- athlete = client.get_athlete()
- print("Now authenticated for " + athlete.firstname + " " + athlete.lastname)
- print("For {id}, I now have an access token {token}".format(id=athlete.id, token=access_token))
- client.create_activity(
- name = 'Manual create activity Name testing Strava_API ',
- start_date_local = '2018-05-19T00:00:00Z',
- elapsed_time = 2700,
- distance = 1000.0,
- description = 'Description Name for testing Strava_API',
- activity_type = 'Run'
- )
- No such attribute subscription_permissions on entity <Athlete id=3*1 firstname=A*i lastname=K*k>
- Now authenticated for A*i K*k
- For 3*1, I now have an access token 3*84
- Traceback (most recent call last):
- File "K:Egoc0d3_ownPythoncsv2strava.py", line 19, in <module>
- activity_type = 'Run'
- File "k:DistribCodingPython36libsite-packagesstravalibclient.py", line 549, in create_activity
- raw_activity = self.protocol.post('/activities', **params)
- File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 255, in post
- return self._request(url, params=params, files=files, method='POST', check_for_errors=check_for_errors, use_webhook_server=use_webhook_server)
- File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 170, in _request
- self._handle_protocol_error(raw)
- File "k:DistribCodingPython36libsite-packagesstravalibprotocol.py", line 215, in _handle_protocol_error
- raise x
- requests.exceptions.HTTPError: 401 Client Error: Unauthorized [Authorization Error: [{'resource': 'AccessToken', 'field': 'write_permission', 'code': 'missing'}]]]
Add Comment
Please, Sign In to add comment