Package: sdksio-verizon-apis-sdk
Getting Started with VerizonIntroductionThe Verizon Edge Discovery Service API can direct your application clients to connect to the optimal service endpoints for your Multi-access Edge Computing (MEC) applications for every session. The Edge Discovery Service takes into account the current location of a device, its IP anchor location, current network traffic and other factors to determine which 5G Edge platform a device should connect to.Verizon Terms of Service:https://www.verizon.com/business/5g-edge-portal/legal.htmlInstall the PackageThe package is compatible with Python versions3 >=3.7, <= 3.11.
Install the package from PyPi using the following pip command:pipinstallsdksio-verizon-apis-sdk==1.0.0You can also view the package at:https://pypi.python.org/pypi/sdksio-verizon-apis-sdk/1.0.0Initialize the API ClientNote:Documentation for the client can be foundhere.The following parameters are configurable for the API Client:ParameterTypeDescriptionvz_m2m_tokenstringM2M Session TokenenvironmentEnvironmentThe API environment.Default:Environment.PRODUCTIONhttp_client_instanceHttpClientThe Http Client passed from the sdk user for making requestsoverride_http_client_configurationboolThe value which determines to override properties of the passed Http Client from the sdk userhttp_call_backHttpCallBackThe callback value that is invoked before and after an HTTP call is made to an endpointtimeoutfloatThe value to use for connection timeout.Default: 60max_retriesintThe number of times to retry an endpoint call if it fails.Default: 0backoff_factorfloatA backoff factor to apply between attempts after the second try.Default: 2retry_statusesArray of intThe http statuses on which retry is to be done.Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]retry_methodsArray of stringThe http methods on which retry is to be done.Default: ['GET', 'PUT']oauth_client_idstringOAuth 2 Client IDoauth_client_secretstringOAuth 2 Client Secretoauth_tokenOauthTokenObject for storing information about the OAuth tokenoauth_scopesOauthScopeEnumThe API client can be initialized as follows:fromverizon.verizon_clientimportVerizonClientfromverizon.configurationimportEnvironmentclient=VerizonClient(vz_m2m_token='VZ-M2M-Token',oauth_client_id='OAuthClientId',oauth_client_secret='OAuthClientSecret',oauth_scopes=[OauthScopeEnum.DISCOVERYREAD,OauthScopeEnum.SERVICEPROFILEREAD])API calls return anApiResponseobject that includes the following fields:FieldDescriptionstatus_codeStatus code of the HTTP responsereason_phraseReason phrase of the HTTP responseheadersHeaders of the HTTP response as a dictionarytextThe body of the HTTP response as a stringrequestHTTP request infoerrorsErrors, if they existbodyThe deserialized body of the HTTP responseAuthorizationThis API usesOAuth 2 Client Credentials Grant.Client Credentials GrantYour application must obtain user authorization before it can execute an endpoint call in case this SDK chooses to useOAuth 2.0 Client Credentials Grant. This authorization includes the following stepsThefetch_token()method will exchange the OAuth client credentials for anaccess token. The access token is an object containing information for authorizing client requests and refreshing the token itself.You must have initialized the client withscopesfor which you need permission to access.try:client.auth_managers['global'].fetch_token()exceptOauthProviderExceptionasex:# handle exceptionexceptAPIExceptionasex:# handle exceptionThe client can now make authorized endpoint calls.ScopesScopes enable your application to only request access to the resources it needs while enabling users to control the amount of access they grant to your application. Available scopes are defined in theOauthScopeEnumenumeration.Scope NameDescriptionDISCOVERYREADGrant read-only access to discovery dataSERVICEPROFILEREADGrant read-only access to service profile dataSERVICEPROFILEWRITEGrant write access to service profile dataSERVICEREGISTRYREADGrant read-only access to Service registry dataSERVICEREGISTRYWRITEGrant write access to Service registry dataTS_MEC_FULLACCESSFull access for /serviceprofiles and /serviceendpoints.TS_MEC_LIMITACCESSLimited access. Will not allow use of /serviceprofiles and /serviceendpoints but will allow discovery.TS_APPLICATION_ROEDGEDISCOVERYREADEDGESERVICEPROFILEREADEDGESERVICEPROFILEWRITEEDGESERVICEREGISTRYREADEDGESERVICEREGISTRYWRITEREADread accessWRITEread/write accessStoring an access token for reuseIt is recommended that you store the access token for reuse.# store tokensave_token_to_database(client.config.oauth_token)Creating a client from a stored tokenTo authorize a client from a stored access token, just set the access token in Configuration along with the other configuration parameters before creating the client:client=VerizonClient()client.config.oauth_token=load_token_from_database()Complete examplefromverizon.verizon_clientimportVerizonClientfromverizon.models.oauth_scope_enumimportOauthScopeEnumfromverizon.exceptions.oauth_provider_exceptionimportOauthProviderExceptionfromverizon.exceptions.api_exceptionimportAPIException# function for storing token to databasedefsave_token_to_database(oauth_token):# code to save the token to database# function for loading token from databasedefload_token_from_database():# load token from database and return it (return None if no token exists)passfromverizon.verizon_clientimportVerizonClientfromverizon.configurationimportEnvironmentclient=VerizonClient(vz_m2m_token='VZ-M2M-Token',oauth_client_id='OAuthClientId',oauth_client_secret='OAuthClientSecret',oauth_scopes=[OauthScopeEnum.DISCOVERYREAD,OauthScopeEnum.SERVICEPROFILEREAD])# obtain access token, needed for client to be authorizedprevious_token=load_token_from_database()ifprevious_token:# restore previous access tokenconfig=client.config.clone_with(oauth_token=previous_token)client=VerizonClient(config)else:# obtain new access tokentry:token=client.auth_managers['global'].fetch_token()save_token_to_database(token)config=client.config.clone_with(oauth_token=token)client=VerizonClient(config)exceptOauthProviderExceptionasex:# handle exceptionexceptAPIExceptionasex:# handle exception# the client is now authorized and you can use controllers to make endpoint callsList of APIs5G Edge PlatformsService EndpointsService ProfilesDevice ManagementDevice GroupsSession ManagementConnectivity CallbacksAccount RequestsService PlansDevice Profile ManagementDevice MonitoringUICC Device Profile ManagementDevices LocationsDevices Location SubscriptionsDevice Location CallbacksUsage Trigger ManagementSoftware Management Subscriptions V1Software Management Licenses V1Firmware V1Software Management Callbacks V1Software Management Reports V1Software Management Subscriptions V2Software Management Licenses V2Campaigns V2Software Management Callbacks V2Software Management Reports V2Client LoggingServer LoggingConfiguration FilesSoftware Management Subscriptions V3Software Management Licenses V3Campaigns V3Software Management Reports V3Firmware V3Account DevicesSoftware Management Callbacks V3SIM Securefor Io T LicensesAccount SubscriptionsPerformance MetricsDiagnostics SubscriptionsDiagnostics ObservationsDiagnostics HistoryDiagnostics SettingsDiagnostics CallbacksDiagnostics Factory ResetCloud Connector SubscriptionsCloud Connector DevicesDevice Service ManagementDevice ReportsHyper Precise Location CallbacksAnomaly SettingsAnomaly TriggersMEC SitesService Launch ProfilesService Launch RequestsService InstancesService Instance OperationsService OnboardingService MetadataCSP ProfilesService ClaimsOAuth AuthorizationAccountsSMSExclusionsBillingTargetsRepositoriesClasses DocumentationUtility ClassesHttpResponseHttpRequest