标签归档:automation

如何使用SCP或SSH将文件复制到Python中的远程服务器?

问题:如何使用SCP或SSH将文件复制到Python中的远程服务器?

我在本地计算机上有一个文本文件,该文件由cron中运行的每日Python脚本生成。

我想添加一些代码,以使该文件通过SSH安全地发送到我的服务器。

I have a text file on my local machine that is generated by a daily Python script run in cron.

I would like to add a bit of code to have that file sent securely to my server over SSH.


回答 0

您可以使用以下scp命令调用bash命令(它通过SSH复制文件)subprocess.run

import subprocess
subprocess.run(["scp", FILE, "USER@SERVER:PATH"])
#e.g. subprocess.run(["scp", "foo.bar", "joe@srvr.net:/path/to/foo.bar"])

如果您要创建要在同一Python程序中发送的文件,则需要在用于打开文件subprocess.run的代码with块之外调用命令(.close()如果不使用with块),因此您知道它已从Python刷新到磁盘。

您需要预先生成(在源计算机上)并安装(在目标计算机上)ssh密钥,以便scp自动通过您的公共ssh密钥进行身份验证(换句话说,因此您的脚本不需要输入密码) 。

You can call the scp bash command (it copies files over SSH) with subprocess.run:

import subprocess
subprocess.run(["scp", FILE, "USER@SERVER:PATH"])
#e.g. subprocess.run(["scp", "foo.bar", "joe@srvr.net:/path/to/foo.bar"])

If you’re creating the file that you want to send in the same Python program, you’ll want to call subprocess.run command outside the with block you’re using to open the file (or call .close() on the file first if you’re not using a with block), so you know it’s flushed to disk from Python.

You need to generate (on the source machine) and install (on the destination machine) an ssh key beforehand so that the scp automatically gets authenticated with your public ssh key (in other words, so your script doesn’t ask for a password).


回答 1

要使用Paramiko库在Python中执行此操作(即不通过subprocess.Popen或类似程序包装scp),您将执行以下操作:

import os
import paramiko

ssh = paramiko.SSHClient() 
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
ssh.connect(server, username=username, password=password)
sftp = ssh.open_sftp()
sftp.put(localpath, remotepath)
sftp.close()
ssh.close()

(您可能希望处理未知的主机,错误,创建任何必要的目录等)。

To do this in Python (i.e. not wrapping scp through subprocess.Popen or similar) with the Paramiko library, you would do something like this:

import os
import paramiko

ssh = paramiko.SSHClient() 
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
ssh.connect(server, username=username, password=password)
sftp = ssh.open_sftp()
sftp.put(localpath, remotepath)
sftp.close()
ssh.close()

(You would probably want to deal with unknown hosts, errors, creating any directories necessary, and so on).


回答 2

您可能会使用subprocess模块。像这样:

import subprocess
p = subprocess.Popen(["scp", myfile, destination])
sts = os.waitpid(p.pid, 0)

destination形式可能在哪里user@remotehost:remotepath。感谢@Charles Duffy指出了我原始答案中的弱点,该答案使用单个字符串参数来指定scp操作shell=True-无法处理路径中的空格。

模块文档中提供了一些错误检查示例,您可能希望与此操作一起执行。

确保设置了正确的凭据,以便可以在计算机之间执行无人值守的无密码scp。已经有一个stackoverflow问题

You’d probably use the subprocess module. Something like this:

import subprocess
p = subprocess.Popen(["scp", myfile, destination])
sts = os.waitpid(p.pid, 0)

Where destination is probably of the form user@remotehost:remotepath. Thanks to @Charles Duffy for pointing out the weakness in my original answer, which used a single string argument to specify the scp operation shell=True – that wouldn’t handle whitespace in paths.

The module documentation has examples of error checking that you may want to perform in conjunction with this operation.

Ensure that you’ve set up proper credentials so that you can perform an unattended, passwordless scp between the machines. There is a stackoverflow question for this already.


回答 3

有两种方法可以解决此问题:

  1. 包装命令行程序
  2. 使用提供SSH功能的Python库(例如-ParamikoTwisted Conch

每种方法都有其自己的怪癖。如果要包装“ ssh”,“ scp”或“ rsync”之类的系统命令,则需要设置SSH密钥以启用无密码登录。您可以使用Paramiko或其他库将密码嵌入脚本中,但是您可能会发现缺少文档令人沮丧,尤其是如果您不熟悉SSH连接的基础知识(例如-密钥交换,代理等)时。不用说,对于这种事情,SSH密钥几乎总是比密码更好的主意。

注意:如果您打算通过SSH传输文件,则很难克服rsync,尤其是如果替代方法是普通的旧式scp。

我使用Paramiko的目的是替换系统调用,但由于其易用性和直接的熟悉性,我发现自己被包裹的命令所吸引。您可能有所不同。一段时间前,我给了海螺一次,但它对我没有吸引力。

如果选择系统调用路径,Python将提供一系列选项,例如os.system或命令/子进程模块。如果使用2.4+版本,我将使用子流程模块。

There are a couple of different ways to approach the problem:

  1. Wrap command-line programs
  2. use a Python library that provides SSH capabilities (eg – Paramiko or Twisted Conch)

Each approach has its own quirks. You will need to setup SSH keys to enable password-less logins if you are wrapping system commands like “ssh”, “scp” or “rsync.” You can embed a password in a script using Paramiko or some other library, but you might find the lack of documentation frustrating, especially if you are not familiar with the basics of the SSH connection (eg – key exchanges, agents, etc). It probably goes without saying that SSH keys are almost always a better idea than passwords for this sort of stuff.

NOTE: its hard to beat rsync if you plan on transferring files via SSH, especially if the alternative is plain old scp.

I’ve used Paramiko with an eye towards replacing system calls but found myself drawn back to the wrapped commands due to their ease of use and immediate familiarity. You might be different. I gave Conch the once-over some time ago but it didn’t appeal to me.

If opting for the system-call path, Python offers an array of options such as os.system or the commands/subprocess modules. I’d go with the subprocess module if using version 2.4+.


回答 4

达到了相同的问题,但不是“ hacking”或模拟命令行:

在这里找到这个答案。

from paramiko import SSHClient
from scp import SCPClient

ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')

with SCPClient(ssh.get_transport()) as scp:
    scp.put('test.txt', 'test2.txt')
    scp.get('test2.txt')

Reached the same problem, but instead of “hacking” or emulating command line:

Found this answer here.

from paramiko import SSHClient
from scp import SCPClient

ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')

with SCPClient(ssh.get_transport()) as scp:
    scp.put('test.txt', 'test2.txt')
    scp.get('test2.txt')

回答 5

您可以执行以下操作来处理主机密钥检查

import os
os.system("sshpass -p password scp -o StrictHostKeyChecking=no local_file_path username@hostname:remote_path")

You can do something like this, to handle the host key checking as well

import os
os.system("sshpass -p password scp -o StrictHostKeyChecking=no local_file_path username@hostname:remote_path")

回答 6

fabric 可用于通过ssh上传文件:

#!/usr/bin/env python
from fabric.api import execute, put
from fabric.network import disconnect_all

if __name__=="__main__":
    import sys
    # specify hostname to connect to and the remote/local paths
    srcdir, remote_dirname, hostname = sys.argv[1:]
    try:
        s = execute(put, srcdir, remote_dirname, host=hostname)
        print(repr(s))
    finally:
        disconnect_all()

fabric could be used to upload files vis ssh:

#!/usr/bin/env python
from fabric.api import execute, put
from fabric.network import disconnect_all

if __name__=="__main__":
    import sys
    # specify hostname to connect to and the remote/local paths
    srcdir, remote_dirname, hostname = sys.argv[1:]
    try:
        s = execute(put, srcdir, remote_dirname, host=hostname)
        print(repr(s))
    finally:
        disconnect_all()

回答 7

您可以使用为此目的专门设计的vassal软件包。

您只需要安装vassal并执行

from vassal.terminal import Terminal
shell = Terminal(["scp username@host:/home/foo.txt foo_local.txt"])
shell.run()

另外,这将节省您的身份验证凭据,而无需一次又一次地键入它们。

You can use the vassal package, which is exactly designed for this.

All you need is to install vassal and do

from vassal.terminal import Terminal
shell = Terminal(["scp username@host:/home/foo.txt foo_local.txt"])
shell.run()

Also, it will save you authenticate credential and don’t need to type them again and again.


回答 8

我使用sshfs通过ssh挂载远程目录,然后使用shutil复制文件:

$ mkdir ~/sshmount
$ sshfs user@remotehost:/path/to/remote/dst ~/sshmount

然后在python中:

import shutil
shutil.copy('a.txt', '~/sshmount')

此方法的优点是,如果要生成数据而不是本地缓存并发送单个大文件,则可以流式传输数据。

I used sshfs to mount the remote directory via ssh, and shutil to copy the files:

$ mkdir ~/sshmount
$ sshfs user@remotehost:/path/to/remote/dst ~/sshmount

Then in python:

import shutil
shutil.copy('a.txt', '~/sshmount')

This method has the advantage that you can stream data over if you are generating data rather than caching locally and sending a single large file.


回答 9

如果您不想使用SSL证书,请尝试以下操作:

import subprocess

try:
    # Set scp and ssh data.
    connUser = 'john'
    connHost = 'my.host.com'
    connPath = '/home/john/'
    connPrivateKey = '/home/user/myKey.pem'

    # Use scp to send file from local to host.
    scp = subprocess.Popen(['scp', '-i', connPrivateKey, 'myFile.txt', '{}@{}:{}'.format(connUser, connHost, connPath)])

except CalledProcessError:
    print('ERROR: Connection to host failed!')

Try this if you wan’t to use SSL certificates:

import subprocess

try:
    # Set scp and ssh data.
    connUser = 'john'
    connHost = 'my.host.com'
    connPath = '/home/john/'
    connPrivateKey = '/home/user/myKey.pem'

    # Use scp to send file from local to host.
    scp = subprocess.Popen(['scp', '-i', connPrivateKey, 'myFile.txt', '{}@{}:{}'.format(connUser, connHost, connPath)])

except CalledProcessError:
    print('ERROR: Connection to host failed!')

回答 10

使用外部资源paramiko;

    from paramiko import SSHClient
    from scp import SCPClient
    import os

    ssh = SSHClient() 
    ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
    ssh.connect(server, username='username', password='password')
    with SCPClient(ssh.get_transport()) as scp:
            scp.put('test.txt', 'test2.txt')

Using the external resource paramiko;

    from paramiko import SSHClient
    from scp import SCPClient
    import os

    ssh = SSHClient() 
    ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
    ssh.connect(server, username='username', password='password')
    with SCPClient(ssh.get_transport()) as scp:
            scp.put('test.txt', 'test2.txt')

回答 11

scp通过子进程调用命令不允许在脚本内接收进度报告。pexpect可用于提取该信息:

import pipes
import re
import pexpect # $ pip install pexpect

def progress(locals):
    # extract percents
    print(int(re.search(br'(\d+)%$', locals['child'].after).group(1)))

command = "scp %s %s" % tuple(map(pipes.quote, [srcfile, destination]))
pexpect.run(command, events={r'\d+%': progress})

查看局域网中的python复制文件(linux-> linux)

Calling scp command via subprocess doesn’t allow to receive the progress report inside the script. pexpect could be used to extract that info:

import pipes
import re
import pexpect # $ pip install pexpect

def progress(locals):
    # extract percents
    print(int(re.search(br'(\d+)%$', locals['child'].after).group(1)))

command = "scp %s %s" % tuple(map(pipes.quote, [srcfile, destination]))
pexpect.run(command, events={r'\d+%': progress})

See python copy file in local network (linux -> linux)


回答 12

一种非常简单的方法如下:

import os
os.system('sshpass -p "password" scp user@host:/path/to/file ./')

不需要python库(仅适用于os),它可以工作,但是使用此方法依赖于要安装的另一个ssh客户端。如果在另一个系统上运行,可能会导致不良行为。

A very simple approach is the following:

import os
os.system('sshpass -p "password" scp user@host:/path/to/file ./')

No python library are required (only os), and it works, however using this method relies on another ssh client to be installed. This could result in undesired behavior if ran on another system.


回答 13

有点骇人听闻,但以下方法可以工作:)

import os
filePath = "/foo/bar/baz.py"
serverPath = "/blah/boo/boom.py"
os.system("scp "+filePath+" user@myserver.com:"+serverPath)

Kind of hacky, but the following should work :)

import os
filePath = "/foo/bar/baz.py"
serverPath = "/blah/boo/boom.py"
os.system("scp "+filePath+" user@myserver.com:"+serverPath)

Tpot-使用遗传编程优化机器学习管道的Python自动机器学习工具

TPOT代表T基于REE的PipelineO优化T哦哦。将TPOT视为您的数据科学助理TPOT是一种Python自动机器学习工具,可使用遗传编程优化机器学习管道

TPOT将通过智能地探索数千个可能的管道来找到最适合您数据的管道,从而自动化机器学习中最繁琐的部分

一个机器学习流水线示例

一旦TPOT完成搜索(或者您厌倦了等待),它就会为您提供它找到的最佳管道的Python代码,这样您就可以从那里修补管道了

TPOT构建在SCRICKIT-LEARN之上,因此它生成的所有代码看起来都应该很熟悉。如果你熟悉SCRICKIT-不管怎样,还是要学

TPOT仍在积极发展中我们鼓励您定期检查此存储库是否有更新

有关TPOT的更多信息,请参阅project documentation

许可证

请参阅repository license有关TPOT的许可和使用信息

通常,我们已经授权TPOT使其尽可能广泛使用

安装

我们坚持TPOT installation instructions在文档中。TPOT需要Python的正常安装

用法

可以使用TPOTon the command linewith Python code

单击相应的链接以在文档中查找有关TPOT用法的更多信息

示例

分类

以下是光学识别手写数字数据集的最小工作示例

from tpot import TPOTClassifier
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split

digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target,
                                                    train_size=0.75, test_size=0.25, random_state=42)

tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42)
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
tpot.export('tpot_digits_pipeline.py')

运行此代码应该会发现达到约98%测试准确率的管道,并且相应的Python代码应该导出到tpot_digits_pipeline.py文件,如下所示:

import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.preprocessing import PolynomialFeatures
from tpot.builtins import StackingEstimator
from tpot.export_utils import set_param_recursive

# NOTE: Make sure that the outcome column is labeled 'target' in the data file
tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64)
features = tpot_data.drop('target', axis=1)
training_features, testing_features, training_target, testing_target = \
            train_test_split(features, tpot_data['target'], random_state=42)

# Average CV score on the training set was: 0.9799428471757372
exported_pipeline = make_pipeline(
    PolynomialFeatures(degree=2, include_bias=False, interaction_only=False),
    StackingEstimator(estimator=LogisticRegression(C=0.1, dual=False, penalty="l1")),
    RandomForestClassifier(bootstrap=True, criterion="entropy", max_features=0.35000000000000003, min_samples_leaf=20, min_samples_split=19, n_estimators=100)
)
# Fix random state for all the steps in exported pipeline
set_param_recursive(exported_pipeline.steps, 'random_state', 42)

exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)

回归

同样,TPOT可以针对回归问题优化管道。下面是使用Practice波士顿房价数据集的最小工作示例

from tpot import TPOTRegressor
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split

housing = load_boston()
X_train, X_test, y_train, y_test = train_test_split(housing.data, housing.target,
                                                    train_size=0.75, test_size=0.25, random_state=42)

tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2, random_state=42)
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
tpot.export('tpot_boston_pipeline.py')

这将导致管道达到约12.77的均方误差(MSE),并且中的Python代码tpot_boston_pipeline.py应与以下内容类似:

import numpy as np
import pandas as pd
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import PolynomialFeatures
from tpot.export_utils import set_param_recursive

# NOTE: Make sure that the outcome column is labeled 'target' in the data file
tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64)
features = tpot_data.drop('target', axis=1)
training_features, testing_features, training_target, testing_target = \
            train_test_split(features, tpot_data['target'], random_state=42)

# Average CV score on the training set was: -10.812040755234403
exported_pipeline = make_pipeline(
    PolynomialFeatures(degree=2, include_bias=False, interaction_only=False),
    ExtraTreesRegressor(bootstrap=False, max_features=0.5, min_samples_leaf=2, min_samples_split=3, n_estimators=100)
)
# Fix random state for all the steps in exported pipeline
set_param_recursive(exported_pipeline.steps, 'random_state', 42)

exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)

请查看文档以了解more examples and tutorials

对TPOT的贡献

我们欢迎您的光临check the existing issues以获取要处理的错误或增强功能。如果您有扩展TPOT的想法,请file a new issue这样我们就可以讨论一下了

在提交任何投稿之前,请审阅我们的contribution guidelines

对TPOT有问题或有疑问吗?

check the existing open and closed issues看看您的问题是否已经得到处理。如果没有,file a new issue在此存储库上,以便我们可以检查您的问题

引用TPOT

如果您在科学出版物中使用TPOT,请考虑至少引用以下一篇论文:

陈天乐,傅维轩,杰森·H·摩尔(2020)。Scaling tree-based automated machine learning to biomedical big data with a feature set selector生物信息学36(1):250-256

BibTeX条目:

@article{le2020scaling,
  title={Scaling tree-based automated machine learning to biomedical big data with a feature set selector},
  author={Le, Trang T and Fu, Weixuan and Moore, Jason H},
  journal={Bioinformatics},
  volume={36},
  number={1},
  pages={250--256},
  year={2020},
  publisher={Oxford University Press}
}

兰德尔·S·奥尔森、瑞安·J·厄巴诺维茨、彼得·C·安德鲁斯、妮可·A·拉文德、拉克里斯·基德和杰森·H·摩尔(2016)。Automating biomedical data science through tree-based pipeline optimization进化计算的应用,第123-137页

BibTeX条目:

@inbook{Olson2016EvoBio,
    author={Olson, Randal S. and Urbanowicz, Ryan J. and Andrews, Peter C. and Lavender, Nicole A. and Kidd, La Creis and Moore, Jason H.},
    editor={Squillero, Giovanni and Burelli, Paolo},
    chapter={Automating Biomedical Data Science Through Tree-Based Pipeline Optimization},
    title={Applications of Evolutionary Computation: 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 -- April 1, 2016, Proceedings, Part I},
    year={2016},
    publisher={Springer International Publishing},
    pages={123--137},
    isbn={978-3-319-31204-0},
    doi={10.1007/978-3-319-31204-0_9},
    url={http://dx.doi.org/10.1007/978-3-319-31204-0_9}
}

兰德尔·S·奥尔森、内森·巴特利、瑞安·J·厄巴诺维奇和杰森·H·摩尔(2016)。Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data ScienceGECCO 2016论文集,第485-492页

BibTeX条目:

@inproceedings{OlsonGECCO2016,
    author = {Olson, Randal S. and Bartley, Nathan and Urbanowicz, Ryan J. and Moore, Jason H.},
    title = {Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science},
    booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference 2016},
    series = {GECCO '16},
    year = {2016},
    isbn = {978-1-4503-4206-3},
    location = {Denver, Colorado, USA},
    pages = {485--492},
    numpages = {8},
    url = {http://doi.acm.org/10.1145/2908812.2908918},
    doi = {10.1145/2908812.2908918},
    acmid = {2908918},
    publisher = {ACM},
    address = {New York, NY, USA},
}

或者,您也可以使用以下DOI直接引用存储库:

支持TPOT

TPOT是在Computational Genetics LabUniversity of Pennsylvania有了来自NIH在赠款R01 AI117694项下。我们非常感谢美国国立卫生研究院和宾夕法尼亚大学在这个项目的发展过程中给予的支持

TPOT标志是由托德·纽穆伊斯(Todd Newmuis)设计的,他慷慨地为该项目贡献了时间

Prefect 实现数据自动化的最简单方法

你好,世界!👋

我们为数据科学时代重建了数据工程

Prefect是一个新的工作流管理系统,专为现代基础设施而设计,由开源的Prefect Core工作流引擎提供支持。用户组织Tasks变成Flows,县管睡觉

请阅读docs;获取code;询问我们anything好了!

欢迎使用工作流

Prefect的Pythonic API应该会让新手感到熟悉。将函数标记为任务并相互调用以建立流

from prefect import task, Flow, Parameter


@task(log_stdout=True)
def say_hello(name):
    print("Hello, {}!".format(name))


with Flow("My First Flow") as flow:
    name = Parameter('name')
    say_hello(name)


flow.run(name='world') # "Hello, world!"
flow.run(name='Marvin') # "Hello, Marvin!"

有关更多详细信息,请参阅Core docs

UI和服务器

除了Prefect Cloud平台上,Prefect包括一个用于编排和管理流程的开源后端,主要包括Prefect ServerPrefect UI此本地服务器将流元数据存储在Postgres数据库中并公开GraphQL API

在第一次运行服务器之前,请运行prefect backend server若要为本地业务流程配置Prefect,请执行以下操作。请注意,服务器需要DockerDocker Compose去跑步

要启动服务器、UI和所有必需的基础架构,请运行:

prefect server start

一旦所有组件都在运行,您就可以通过访问http://localhost:8080

请注意,从服务器执行流需要至少运行一个Prefect代理:prefect agent local start

最后,要向服务器注册任何流,请调用flow.register()有关更多详细信息,请参阅orchestration docs

“.完全正确?”

来自拉丁语普雷菲克特斯,意思是“谁是负责人”,省长是监督一个领域并确保规则得到遵守的官员。同样,Prefect负责确保工作流正确执行

它也恰好是那本非常了不起的书的一位巡回研究员的名字,银河系漫游指南

集成

得益于Prefect不断扩大的任务库和深度的生态系统集成,构建数据应用程序比以往任何时候都更加容易

有什么东西不见了吗?打开一个feature requestcontribute a PR好了!Prefect旨在使添加新功能变得极其容易,无论您是在开放源码包之上构建,还是为您的团队维护内部任务库

任务库

Airtable

Asana

AWS

Azure

Azure ML

Databricks

DBT

Docker

Dremio

Dropbox

Email

Fivetran

GitHub

Google Cloud

Google Sheets

Great Expectations

Jira

Jupyter

Kubernetes

Monday

MySQL

PostgreSQL

Python

Pushbullet

Redis

RSS

SendGrid

Shell

Slack

Snowflake

SpaCy

SQLite

SQL Server

Trello

Twitter

部署和执行

Azure

AWS

Dask

Docker

Google Cloud

Kubernetes

Universal Deploy

资源

Prefect提供了各种资源来帮助您获得成功的结果

我们致力于确保一个积极的环境,所有的互动都由我们的Code of Conduct

文档

Prefect的文档–包括概念、教程和完整的API参考–总是可以在docs.prefect.io

有关编写文档的说明,请参阅development guide

松散社区

加入我们的Slack聊聊Prefect,提问,分享小贴士

博客

访问Prefect Blog有关Prefect团队的最新信息和见解

支持

Prefect提供各种社区和高级服务support options适用于Prefect Core和Prefect Cloud的用户

贡献

阅读有关Prefect的community或者一头扎进development guides有关贡献、文档、代码样式和测试的信息

安装

要求

Prefect需要Python 3.6+。如果您是Python新手,我们建议您安装Anaconda distribution

最新版本

要安装Prefect,请运行:

pip install prefect

或者,如果您更喜欢使用conda

conda install -c conda-forge prefect

pipenv

pipenv install --pre prefect

出血边缘

为了进行开发或只是尝试最新的功能,您可能希望直接从源代码安装Prefect

请注意,Prefect的主分支不保证与Prefect Cloud或本地服务器兼容

git clone https://github.com/PrefectHQ/prefect.git
pip install ./prefect

许可证

Prefect Core根据Apache Software License Version 2.0请注意,Prefect Core包括用于运行Prefect Server以及Prefect UI,它们本身是根据Prefect Community License

Leon-🧠leon是您的开源个人助理


👋引言

里昂是一种开源个人助理谁能活下来在您的服务器上

做一些事情当你向他索要

你可以的跟他谈谈而且他可以跟你谈谈您还可以给他发短信他还可以给你发短信如果你愿意,里昂可以通过离线保护您的隐私

为什么?

  1. 如果您是(或不是)开发人员,您可能想要构建许多对您的日常生活有帮助的东西。Leon可以帮助您构建他的包/模块(技能)结构,而不是为每个想法构建专门的项目
  2. 使用这种通用结构,每个人都可以创建自己的模块并与其他人共享。因此,只有一个核心(统治所有的核心)
  3. 里昂使用人工智能概念,这很酷
  4. 隐私问题,您可以将Leon配置为与他离线通话。你已经可以在没有任何第三方服务的情况下和他发短信了
  5. 开源是很棒的

这个存储库是用来做什么的?

此资料库包含Leon的以下节点:

  • 服务器
  • 包/模块
  • Web应用程序
  • HotWord节点

里昂能做什么?

今天,最有趣的部分是关于他的核心和他可以扩大规模的方式。他相当年轻,但可以很容易地扩展以拥有新功能(包/模块)。您可以通过浏览packages list

听起来不错吧?那我们开始吧!

☁️单击即可尝试

Gitpod将自动设置环境并为您运行实例

🚀快速入门

必备条件

要安装这些必备组件,可以按照How To section文档的

安装

# Clone the repository (stable branch)
git clone -b master https://github.com/leon-ai/leon.git leon
# OR download the latest release at: https://github.com/leon-ai/leon/releases/latest

# Go to the project root
cd leon

# Install
npm install

用法

# Check the setup went well
npm run check

# Build
npm run build

# Run
npm start

# Go to http://localhost:1337
# Hooray! Leon is running

Docker安装

# Build
npm run docker:build

# Run
npm run docker:run

# Go to http://localhost:1337
# Hooray! Leon is running

📚文档

有关完整文档,请访问docs.getleon.ai

🧭路线图

要了解正在发生的情况,请关注roadmap.getleon.ai

❤️贡献

如果你有改进里昂的主意,请不要犹豫。

里昂需要开源才能生存,他的模块越多,他就变得越熟练

📖里昂背后的故事

你会发现关于这件事的评论blog post

🔔敬请关注

👨作者

路易斯·格勒纳德(@louistiti_fr)

👍赞助商

您也可以通过以下方式进行贡献sponsoring Leon

请注意,我把大部分空闲时间都花在了里昂身上。

通过赞助项目,您可以使项目具有可持续性,并且开发功能的速度更快

关注的焦点不仅限于你在GitHub上看到的活动,还包括对项目方向的很多思考。这与整体设计、架构、视觉、学习过程等自然相关

📝许可证

MIT License

版权所有(C)2019年-目前,路易斯·格勒纳德louis.grenard@gmail.com

干杯!

InstaPy-📷InstagramBot-用于自动Instagram交互的工具

InstaPy

用来加工的工具自动化您的社交媒体交互可以使用Selenium模块在使用Python实现的Instagram上“农场”赞、评论和关注者

Twitter of InstaPy|Twitter of Tim|Discord Channel|How it works (FreeCodingCamp)|
Talk about automating your Instagram|Talk about doing Open-Source work|Listen to the “Talk Python to me”-Episode

时事通讯:Sign Up for the Newsletter here!
官方视频指南:Get it here!
机器人创建指南:Learn to Build your own Bots with the Creators of InstaPy
我们的数据可视化实践研讨会:Learn to create insightful Visualizations from Scratch!

从头开始学习自动化:The School of Automation
学习构建您自己的InstaPy的技能:Automating Social Media Interactions

找到完整的文档,请访问InstaPy.org

目录

学分

社区

一个积极和支持的社区是每个开源项目都需要维持的。我们一起到达了世界上的每个大洲和大多数国家!
感谢你们成为InstaPy社区的一员✌️

贡献者

这个项目的存在要归功于所有做出贡献的人。[Contribute]

支持者

感谢我们所有的支持者!🙏[Become a backer]


免责声明: Please note that this is a research project. I am by no means responsible for any usage of this tool. Use it on your behalf. I’m also not responsible if your accounts get banned due to the extensive use of this tool.