调用google提供的短地址服务 http://goo.gl/

使用Python生成短链接
本文介绍了一种利用Python 2.6实现短链接生成的方法。通过向Google提供的API发送请求并将长链接转换为短链接。具体步骤包括构建请求数据、发送HTTP请求及解析返回的JSON数据。

 

09-03 20:50:11.060778 1953 2784 D OplusAONSmartDim: onWakeLockAcquireLocked: lock=130613568, flags=0x1000000a, packageName=com.android.server.cts.device.statsdatom, tag="StatsdBrightnessTest", ws=null, uid=10408, pid=7637 09-03 20:50:11.061152 7662 7686 I EngineFactory: Provider GmsCore_OpenSSL not available 09-03 20:50:11.061298 1953 2784 I PowerManagerService: Allowing device wake-up without android.permission.TURN_SCREEN_ON for com.android.server.cts.device.statsdatom 09-03 20:50:11.061300 3639 3685 I AdapterProperties: getBondedDevices: length=0 09-03 20:50:11.061303 4298 21997 I SettingImpl: export quick device toggle value is 1 09-03 20:50:11.061334 1953 2784 D OplusFeatureAOD: notifySfUnBlockScreenOn 09-03 20:50:11.061439 1953 2784 D OplusPowerManagerHelper: scheduleNotifyStopDream 09-03 20:50:11.061466 4298 21997 I PTC.DISC.BleDiscover: startDiscoveryInternal Out. response(startScan) traceId=7a4815c6-c15c-4e14-9e0d-934871ca7889, client=DiscoveryClient(id=Auto, pkg=PantaConnect, pid=-1), result=null, exception=Fails to ble scan due to quickDeviceConnectToggle is off. 09-03 20:50:11.061489 1953 2029 D OplusPowerManagerHelper: handleMessage:102 09-03 20:50:11.061509 1953 2029 D OplusPowerManagerHelper: MSG_STOP_DEAM 09-03 20:50:11.061515 4298 21997 E PTC.DISC.BleDiscover: Auto scan failed, msg=Fails to ble scan due to quickDeviceConnectToggle is off. 09-03 20:50:11.061531 1209 2397 I DispPerfService: NOTIFY_UNBLOCKSCREEN 09-03 20:50:11.061863 3111 3111 D AbstractBtDlgCtr: Unable to get current codec config. No active device. 09-03 20:50:11.061940 3111 3111 D BluetoothAdapter: getActiveDevices(profile= A2DP) 09-03 20:50:11.061598 2478 2710 I SystemUi--Statusbar: BluetoothController-->onBluetoothStateChanged bluetoothState=12 09-03 20:50:11.062567 1183 1183 D vendor.oplus.hardware.stability.oplus_project-V1-service: write 29 bytes 09-03 20:50:11.062667 1183 1183 D vendor.oplus.hardware.stability.oplus_project-V1-service: write_theia_proc path:/proc/theiaPwkReport ,theia_date:CANCELED_wakePowerGroupLocked 09-03 20:50:11.064045 7662 7686 W Melody_MelodyModelManager: <init> settings timeMillis=182 09-03 20:50:11.064512 1953 2784 E OGuardManager: mMainHandler is null. 09-03 20:50:11.064680 2478 2478 D SystemUi--QuickSettings: OplusBluetoothTile-->Receive: android.bluetooth.adapter.action.STATE_CHANGED 09-03 20:50:11.064715 2478 2478 D Tile.OplusBluetoothTile: refreshState: tile not listening, ignore 09-03 20:50:11.064779 2478 2478 D SystemUi--Statusbar: OplusPhoneStatusBarPolicyEx-->updateBluetooth(), isBluetoothEnabled = true, isBluetoothConnected = false 09-03 20:50:11.064862 3111 3111 D AbstractBtDlgCtr: Unable to get current codec config. No active device. 09-03 20:50:11.064904 2478 2478 D SystemUi--Statusbar: OplusPhoneStatusBarPolicyEx-->updateBluetooth(), resourceId = 2131237111, enabled = true, slotBluetooth = bluetooth 09-03 20:50:11.065040 3639 3652 D BTEnterpriseFeature: CheckCurrentValue persist.sys.oplus.bt.policy_discoverable 09-03 20:50:11.065045 3111 3111 D BluetoothAdapter: getActiveDevices(profile= A2DP) 09-03 20:50:11.065317 3639 3652 D BTEnterpriseFeature: CheckCurrentValue persist.sys.oplus.bt.policy_connectable 09-03 20:50:11.065411 3639 3652 D OplusBtAppCallStats_apk: recordAppCall(): call setScanMode() 09-03 20:50:11.065440 3639 3652 D OplusBtAppCallStats_apk: recordAppCall(): com.oplus.wirelesssettings call setScanMode() 09-03 20:50:11.065536 3639 3652 D OplusBtAppCallStats_apk: recordAppCall(): CallParameter0 = 23 09-03 20:50:11.065606 3639 3652 I OplusAdapterServiceExtImpl: oplusSetScanMode currentIac: GIAC calling package is com.oplus.wirelesssettings mode = 23 09-03 20:50:11.065889 3639 3652 I OplusAdapterServiceExtImpl: oplusSetScanMode mNlManager.isNetworklessEnable() = false 09-03 20:50:11.065920 3639 3652 D NetworklessManager: isNetworkSupported from com.android.bluetooth 09-03 20:50:11.066291 1953 3285 D OplusBtSwitchEventStats_fwk: bindingCompleteCallback, onCreateStart: 26323, onCreateFinish: 29383 09-03 20:50:11.066605 3111 3111 D AbstractBtDlgCtr: Unable to get current codec config. No active device. 09-03 20:50:11.066623 3639 3652 D OplusBluetoothPerformanceParamsConfigImpl: updataBrScanMode: featureID is 0 scanModeLap is GIAC 09-03 20:50:11.066650 3111 3111 D AbstractBtDlgCtr: Unable to get current config index. Current codec Config is null. 09-03 20:50:11.066688 3639 3652 D OplusBtNativeChannelUtils: unknown down sync type:35 09-03 20:50:11.066712 3639 3652 D OplusBtNativeChannel: downSync(): type= 35 09-03 20:50:11.066719 3111 3111 D BluetoothAdapter: getActiveDevices(profile= A2DP) 09-03 20:50:11.066797 3639 3652 I oplus_bt_dual_sync: [oplus_bt_dual_sync.cc:145] stack_down_sync_action: type=35, len=28 09-03 20:50:11.066838 3639 3652 I oplus_bt_dual_sync: [oplus_bt_dual_sync.cc:384] stack_down_sync_action: featureID 0, scan_mode_iac is GIAC 09-03 20:50:11.066854 1123 1123 D pfaca_s : command = 127 is not supported 09-03 20:50:11.066893 1123 1123 D pfaca_s : value = -1 09-03 20:50:11.066926 3639 3652 D OplusBluetoothPerformanceParamsConfigImpl: updataBrScanMode: downSync is succesfull 09-03 20:50:11.066956 3639 3652 I OplusAdapterServiceExtImpl: oplusSetScanMode mNlManager.isNetworklessEnable is false or mOplusBluetoothPerformanceParamsConfig is null set default iac to GIAC 09-03 20:50:11.067019 3639 5295 D OplusBluetoothScenarioMonitor: handle message, msg.what = 3 09-03 20:50:11.067086 7662 7700 W om.oplus.melody: Long monitor contention with owner ForkJoinPool.commonPool-worker-1 (7686) at java.lang.Object java.util.concurrent.ConcurrentHashMap.computeIfAbsent(java.lang.Object, java.util.function.Function)(ConcurrentHashMap.java:1719) waiters=0 in java.lang.Object java.util.concurrent.ConcurrentHashMap.computeIfAbsent(java.lang.Object, java.util.function.Function) for 133ms 09-03 20:50:11.067279 3894 5135 I aemf : openMicEarlyInInteractorProcess is enabled. Mic is not suppressed even when delegation is disabled. 09-03 20:50:11.067293 30822 31436 I NearbyDiscovery: (REDACTED) OffloadFastPairScanner: eventType=%s, isInternalReq=%s, isOffloadScanning=%s, isOffloadScanningAllowed=%s 09-03 20:50:11.067350 3894 5135 I aemf : openMicEarlyInInteractorProcess is enabled. Mic is not suppressed even when delegation is disabled. There were 4 failures: missing (1): 47 --- expected : [47, 55] but was : [55] at android.cts.statsdatom.statsd.UidAtomTests.testScreenBrightness(UidAtomTests.java:622) at [[Reflective call: 2 frames collapsed (https://goo.gl/aH3UyP)]].(:0) at [[Testing framework: 2 frames collapsed (https://goo.gl/aH3UyP)]].(:0) at com.android.tradefed.testtype.DeviceTestResult$1.protect(DeviceTestResult.java:99) at com.android.tradefed.testtype.DeviceTestResult.runProtected(DeviceTestResult.java:73) at com.android.tradefed.testtype.DeviceTestResult.run(DeviceTestResult.java:104) at junit.framework.TestCase.run(TestCase.java:130) at com.android.tradefed.testtype.DeviceTestCase.run(DeviceTestCase.java:170) at com.android.tradefed.testtype.JUnitRunUtil.runTest(JUnitRunUtil.java:65) at com.android.tradefed.testtype.JUnitRunUtil.runTest(JUnitRunUtil.java:44) at com.android.tradefed.testtype.JUnitRunUtil.runTest(JUnitRunUtil.java:39) at com.android.tradefed.testtype.DeviceTestCase.run(DeviceTestCase.java:146) at com.android.tradefed.testtype.HostTest.runRemoteTest(HostTest.java:712) at com.android.tradefed.testtype.HostTest.runTestClasses(HostTest.java:620) at com.android.tradefed.testtype.HostTest.run(HostTest.java:603) at com.android.compatibility.common.tradefed.testtype.JarHostTest.run(JarHostTest.java:56) at com.android.tradefed.testtype.suite.GranularRetriableTestWrapper.intraModuleRun(GranularRetriableTestWrapper.java:448) at com.android.tradefed.testtype.suite.GranularRetriableTestWrapper.run(GranularRetriableTestWrapper.java:341) at com.android.tradefed.testtype.suite.ModuleDefinition.run(ModuleDefinition.java:620) at com.android.tradefed.testtype.suite.ITestSuite.runSingleModule(ITestSuite.java:1398) at com.android.tradefed.testtype.suite.ITestSuite.run(ITestSuite.java:1099) at com.android.tradefed.invoker.InvocationExecution.runTest(InvocationExecution.java:1467) at com.android.tradefed.invoker.InvocationExecution.runTests(InvocationExecution.java:1242) at com.android.tradefed.invoker.TestInvocation.prepareAndRun(TestInvocation.java:667) at com.android.tradefed.invoker.TestInvocation.performInvocation(TestInvocation.java:298) at com.android.tradefed.invoker.TestInvocation.invoke(TestInvocation.java:1503) at com.android.tradefed.command.CommandScheduler$InvocationThread.run(CommandScheduler.java:727) missing (1): 47
最新发布
09-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值