Category Archives: Python

request-python

迫不及待了吗?本页内容为如何入门 Requests 提供了很好的指引。其假设你已经安装了... Read More | Share it now!

APScheduler-Python定时任务

1 简介 APScheduler的全称是Advanced Python Scheduler。它是一个轻量级的 Python 定时任务调度框架。APScheduler 支持三种调度任务:固定时间间隔,固定时间点(日期),Linux 下的 Crontab... Read More | Share it now!

详解python调用redis lua内嵌脚本的高级用法

Lua 脚本功能是 Reids 2.6 版本开始提供的高级功能, 我们可以通过redis内嵌的 Lua 环境的进行搞复杂的需求。 使用内置的lua脚本环境可以解决Redis长久以来不能高效地处理 CAS... Read More | Share it now!

prometheus/client_python

Prometheus Python Client The official Python 2 and 3 client for Prometheus. https://github.com/prometheus/client_python Three Step Demo One: Install the client: pip install prometheus_client Two: Paste the following into a Python interpreter: from... Read More | Share it now!

How to Install Ruby 2.4 on CentOS/RHEL 7/6

Ruby 2.4.2 Released, Ruby is a dynamic, object-oriented programming language focused on simplicity and productivity. RVM (Ruby Version Manager) is a tool for installing and managing multiple Ruby versions on single operating systems. This tutorial will... Read More | Share it now!

Python单元测试unittest

Python中有一个自带的单元测试框架是unittest模块,用它来做单元测试,它里面封装好了一些校验返回的结果方法和一些用例执行前的初始化操作。 在说unittest之前,先说几个概念: TestCase... Read More | Share it now!

Python Mock的入门

Mock是什么 Mock这个词在英语中有模拟的这个意思,因此我们可以猜测出这个库的主要功能是模拟一些东西。准确的说,Mock是Python中一个用于支持单元测试的库,它的主要功能是使用mock对象替代掉指定的Python对象,以达到模拟对象的行为。简单的说,mock库用于如下的场景: 假设你开发的项目叫a,里面包含了一个模块b,模块b中的一个函数c(也就是a.b.c)在工作的时候需要调用发送请求给特定的服务器来得到一个JSON返回值,然后根据这个返回值来做处理。如果要为a.b.c函数写一个单元测试,该如何做? 一个简单的办法是搭建一个测试的服务器,在单元测试的时候,让a.b.c函数和这个测试服务器交互。但是这种做法有两个问题: 测试服务器可能很不好搭建,或者搭建效率很低。 你搭建的测试服务器可能无法返回所有可能的值,或者需要大量的工作才能达到这个目的。 那么如何在没有测试服务器的情况下进行上面这种情况的单元测试呢?Mock模块就是答案。上面已经说过了,mock模块可以替换Python对象。我们假设a.b.c的代码如下: import... Read More | Share it now!

redis-py-cluster 1.3.4

Project description # redis-py-cluster This client provides a client for redis cluster that was added in redis 3.0. This project is a port of `redis-rb-cluster` by antirez, with alot of added functionality. The original source can be found at... Read More | Share it now!