Package: nikepysdk
This is anunofficialPython3 API wrapper for Nike services. WIP.Basic Usageimportnikepysdknike=nikepysdk.NikeSdk()username='test@example.com'password='Password123!'access_token=nike.get_access_token(username,password)print(access_token)# Some long access tokenaccount_verified=nike.is_account_verified(access_token)print(account_verified)# True or Falseaccount_data={'email':'newaccount@example.com','password':'Password12345!','first_name':'John','last_name':'Smith','date_of_birth':'2000-01-01',# YYYY-MM-DD'gender':'male'# or female}account_created=nike.create_account(account_data)print(account_created)event=nike.get_event_by_id(88145)print(event.event_id,event.title,event.location)SDK Documentationnike.get_access_tokennike.get_access_token(username, password)Returns an access token for an account given a username and password
that can be used to interact with authenticated API endpoints.Parametersstring- Username for the accountstring- Password for the accountReturnsstringAccess token in a string formatExampleusername='example@test.com'password='Password123!'access_token=nike.get_access_token(username,password)print(access_token)# Some long stringnike.create_accountnike.create_account(account_data)Creates a new Nike+ account given the account data.account_datais
a dictionary with the following schema:{
    'email': string,
    'password': string,
    'first_name': string,
    'last_name': string,
    'date_of_birth': string, # YYYY-MM-DD
    'gender': string # 'male' or 'female'
}Parametersdict- Account data as a dictReturnsboolSuccess of the account creationExampleaccount_data={'email':'newaccount@example.com','password':'Password12345!','first_name':'John','last_name':'Smith','date_of_birth':'2000-01-01',# YYYY-MM-DD'gender':'male'# or female}account_created=nike.create_account(account_data)print(account_created)# True, hopefullynike.is_account_verifiednike.is_account_verified(access_token)Checks if an account is verified given an account’s valid access tokenParametersstring- Account access tokenReturnsboolIf the account is verified or notExampleis_verified=nike.create_account(access_token)print(is_verified)# True, hopefullynike.send_sms_codenike.send_sms_code(access_token, phone_number)Sends an SMS verification code to an account given its access token and
phone number.Parametersstring- Account access tokenstring- Phone number to send code toReturnsboolSuccess of the operationExamplephone_number='1112223333'sms_sent=nike.send_sms_code(access_token,phone_number)print(sms_sent)# True, hopefullynike.verify_sms_codenike.verify_sms_code(access_token, sms_code)Verifies the SMS code for an account.Parametersstring- Account access tokenstring- SMS code that was receivedReturnsboolSuccess of the operationExamplesms_code='123456'sms_verified=nike.verify_sms_code(access_token,sms_code)print(sms_verified)# True, hopefullynike.add_shipping_addressnike.add_shipping_address(access_token, shipping_info)Adds a new shipping address to an account.shipping_infois a
dictionary with the following schema:{
    'first_name': string,
    'last_name': string,
    'address_1': string,
    'address_2': string,
    'city': string,
    'state': string, # Initials
    'zip': string,
    'phone': string, # 1112223333
}Parametersstring- Access token for the account_dict- Shipping address data as a dictReturnsstringAddress ID for use in adding billing infoExampleshipping_info={'first_name':'John','last_name':'Smith','address_1':'123 Main Street','address_2':'APT 1A','city':'Sometown','state':'OH','zip':'12345','phone':'1234567890'}address_id=nike.add_shipping_address(access_token,shipping_info)print(address_id)# Some uuid4 stringnike.add_cardnike.add_card(access_token, card_info)Adds a new card to an account.card_infois a dictionary with the
following schema:{
    'number': string,
    'type': string, # VISA or similar
    'exp_month': string, # XX
    'exp_year': string, # XXXX
    'cvv': string
}Parametersstring- Access token for the account_dict- Card data as a dictReturnsstringCard ID for use in adding billing infoExamplecard_info={'number':'1111222233334444,'type':'VISA',# VISA or similar'exp_month':'12',# XX'exp_year':'2021',# XXXX'cvv':'123'}card_id=nike.add_card(access_token,card_info)print(card_id)# Some uuid4 stringnike.add_billing_infonike.add_billing_info(access_token, access_token, billing_info, address_id, card_id)Adds a new billing profile to an account.billing_infois a
dictionary with the following schema:{
    'first_name': string,
    'last_name': string,
    'address_1': string,
    'address_2': string,
    'city': string,
    'state': string, # Initials
    'zip': string,
    'phone': string, # 1112223333
}address_idandcard_idare IDs returned byadd_shipping_addressandadd_card.Parametersstring- Access token for the accountdict- Billing data as a dictstring- Address ID to add to the profilestring- Card ID to add to the profileReturnsboolSuccess of the operationExamplebilling_info={'first_name':'John','last_name':'Smith','address_1':'123 Main Street','address_2':'APT 1A','city':'Sometown','state':'OH','zip':'12345','phone':'1234567890'}billing_added=nike.add_billing_info(access_token,billing_info,address_id,card_id)print(billing_added)# True, hopefullynike.get_event_by_idnike.get_event_by_id(event_id)Returns aNikeEventobject that contains information about an eventParametersstring- ID of the eventReturnsNikeEventEvent data as aNikeEventobjectExampleevent_id='12345'event=nike.get_event_by_id(event_id)print(event.title)# Some string