在您的应用程序中提交并检索来自ghostbin的粘贴!支持ghostbin.com和任何自行托管的ghostbin实例。

PyGhostLid的Python项目详细描述


在您的应用程序中提交并检索来自ghostbin的粘贴!这个 库同时支持ghostbin.com和 鬼魂。

“鬼魂”这个名字是基于这个图书馆坐落在 在应用程序和ghostbin之间,就像盖子一样 在你和垃圾/堆肥箱之间。

这是一个超级简单的图书馆,但我认为值得分享 无论如何。

什么是鬼怪?为什么是这个图书馆?

ghostbin是一个开源的“pastebin”类web应用程序,它允许 要上载任意文本文件以便在Internet上共享的用户:用于 例如,请求帮助时共享代码或配置文件 论坛、reddit或irc频道;联系 技术支持论坛或IRC频道;或与 即时通讯上的朋友,这通常不是很友好 信息。

此便利库适用于任何需要 快速上传到鬼怪箱。例如,内置的ghostbin 在即时消息应用程序或具有 点击“上传到鬼怪箱”按钮,错误信息/堆栈跟踪 允许他们轻松地请求帮助或包含在错误报告中。

要求

此库需要python 3.x,建议使用>;=3.2。它是经过测试的 与Python3.5相比。

基本用法

这个库由一个类GhostLid组成,并且已经死了 很简单。查看下面的基本示例,以及 有关可用选项的详细信息,包括使用 不是ghostbin.com的主机并设置默认值。

# The text we want to pastepaste_text="""
[04:10:07] <John> hi
[04:10:13] <Jane> hi
[04:19:21] <John> good talk
"""# SetupfromghostlidimportGhostLidghostlid=GhostLid()ghostlid.load_languages()# Here's a simple list of supported languageslang_list=ghostlid.get_lang_list()# And here's the full info on languages - this has enough info to build a nice user interface# See the "languages.json" section of this page: https://ghostbin.com/paste/p3qcylang_info=ghostlid.get_language_info()# Paste some text (NOTE: AVOID FOR TEST PASTES - please use an expiration time limit!)paste_url=ghostlid.paste(paste_text)print("Your paste was uploaded to this URL: "+paste_url)# Specify a language (usually programming language) for syntax highlightingpaste_url=ghostlid.paste(paste_text,lang="irc")# Encrypt the paste with a passwordpaste_url=ghostlid.paste(paste_text,password="correct horse battery staple",lang="irc")# Paste with an expiration of 10 minutespaste_url=ghostlid.paste(paste_text,expire="10m",lang="irc")# Get the ghostbin protocol info paste at https://ghostbin.com/paste/p3qcyretrieved_paste_text=ghostlid.get_paste('p3qcy')# Get the paste we submitted abovepaste_id=ghostlid.get_paste_id(paste_url)retrieved_paste_text=ghostlid.get_paste(paste_id)

已知问题

  • 检索get_paste()当时不适用于ghostbin.com 因为the /raw feature was disabled 由于滥用的主站点。它仍然可以在代码库和五月 或者在任何自托管的ghostbin实例上都不能启用。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何显示因用户而异的SQLite存储数据?   转换java。sql。将映射传递给Jackon的valueToTree方法时StringNode的时间戳   从java中的列表json获取值   unicode Java字符存储在什么编码中?   java如何让Spring数据存储库中的默认方法命中缓存?   java使用readClassDescriptor()和resolveClass()来允许序列化版本控制   数组通过另一个矩阵的一部分填充矩阵   如果包含使用正则表达式的字符串,则替换父XML标记的java   java清除SharedReference中的单个变量   java将变量值从一个jsp页面传输到另一个jsp页面   java JDBC+SQLite:DriveManager不加载所需的驱动程序   相同源代码的java Kotlin构建生成不同的二进制文件   Java中的元组枚举