The Strava API documentation gives the following sample code which I copied and entered my own access token and club ID:
Enter code here...from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: strava_oauth
swagger_client.configuration.access_token = 'MY_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.ClubsApi()
id = MY_CLUB_ID # Integer | The identifier of the club.
page = 56 # Integer | Page number. (optional)
perPage = 56 # Integer | Number of items per page. Defaults to 30. (optional) (default to 30)
try:
# List Club Activities
api_response = api_instance.getClubActivitiesById(id, page=page, perPage=perPage)
pprint(api_response)
except ApiException as e:
print("Exception when calling ClubsApi->getClubActivitiesById: %s\n" % e)
When I try to run it I get
from future import print_statement SyntaxError: future feature print_statement is not defined
I can also see that I will get the same with my swagger_client
imports. I've tried installing packages for each but this hasn't made any difference. I read that for the future I should be on > Python 2.7 but I'm currently using 3.6.
How do I resolve this issue?
--
You received this message because you are subscribed to the Google Groups "Strava API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strava-api+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Traceback (most recent call last):
File "/Users/me/PycharmProjects/stravakomtracker/clubkomtracker.py", line 3, in <module>
import swagger_client
ModuleNotFoundError: No module named 'swagger_client'
java -jar swagger-codegen-cli-<ver>.jar generate -i https://developers.strava.com/swagger/swagger.json -l python -o ./StravaPythonClient