tencent cloud

TencentDB for Tendis

Release Notes
Product Introduction
Overview
Strengths
Use Cases
Product Series
Performance
Command Compatibility
Regions and AZs
Relevant Concepts
Relevant Products
Purchase Guide
Billing Overview
Pricing
Payment Overdue Policy
Getting Started
Creating Tendis Instances
Connecting to Tendis Instances
iptables Forwarding
Operation Guide
Instance Connection Using Programming Languages
Instance Maintenance and Management
Monitoring Features
Configuring Security Groups
Disabling Commands
FAQs
General
Purchase
Connection and Login
Contact Us
Tendis Policy
Privacy Policy
Data Privacy and Security Agreement
Glossary

Python Connection Sample

PDF
Focus Mode
Font Size
Last updated: 2023-12-21 21:11:33
Preparations before running: Download and install redis-py.
Sample code:
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import redis

#Replace with the host address and port number of the instance to be connected
host = '192.xx.xx.195'
port = 6379

#Replace with the password of the instance to be connected

pwd='password'

#When connecting, specify the AUTH information through the "password" parameter.
r= redis.StrictRedis(host=host, port=port, password=pwd)

#Database operations can be performed after the connection is established. For more information, please visit https://github.com/andymccurdy/redis-py.
r.set('name', 'python_test');
print r.get('name')
Execution results:


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback