Code Monkey home page Code Monkey logo

alfred-pastebin's Introduction

Alfred Pastebin

Automatically create a new paste in Pastebin.com from your clipboard

Requirements

  • Alfred 4
  • Powerpack
  • Python 3+

Installation

  1. Download latest release here
  2. Double-click to add to Alfred
  3. Go to Pastebin API page and copy the key in the section named Your Unique Developer API Key
  4. Open Alfred, go to workflow environment variables and put the copied key into variable API_DEV_KEY

Guest Mode

By default, this workflow will paste your content as a guest.

If you want to paste on your account you need to enter your Pastebin username and password in variable API_USER_NAME and API_USER_PASSWORD, respectively.

Usage

pb [name] [language]

Note

  • name and language are optional
  • (CMD + Enter) to create as unlisted paste (by default)
  • Please be careful on unlisted or private paste since a free Pastebin account has a paste limit on those two types of permission

Workflow Environment Variables

Name Default Required Description
API_DEV_KEY - Yes Your Unique Developer API Key
API_USER_NAME - No Your Pastebin username (see: Guest Mode)
API_USER_PASSWORD - No Your Pastebin password (see: Guest Mode)
DEFAULT_NAME Untitled Yes Default paste name if not defined
DEFAULT_PERMISSION public Yes Paste permission (available value: public, unlisted, private)
CMD_PERMISSION unlisted Yes Paste permission if you hold CMD
EXPIRE_DATE 1W Yes Paste expiration date (available value)

Like it?

Buy Me A Coffee

alfred-pastebin's People

Contributors

earthpyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

alfred-pastebin's Issues

[Feature Request] Universal Action

Hi Preeti,

Can you kindly consider adding universal action as a way to trigger the workflow in addition to or in place of using the clipboard text?

This way we can simply highlight the text we want to send to pastebin, press the Universal Action hotkey and have the shareable URL ready to be pasted in the clipboard.

Workflow keeps saying 'Bad API'

As title. I'm sure that the API is right. I tried to put it into the Alfred variable both in 'API' and API formats, none of them worked. Thanks in advance for your help!

[Feature Request] Add an argument to copy the raw link

Hi Preeti,

Can you kindly consider adding raw as one of the optional arguments to the pb command?

Like this:

pb [name] [language] [raw]

so that if I run pb raw, the workflow uploads to pastebin.com and copies the generated pastebin link's raw URL.

Ex.:

https://pastebin.com/raw/SeYUkYMd

AttributeError: module 'urllib' has no attribute 'urlopen'

Hi,

The workflow doesn't seem to be working. When I try it shows an error.

Log from the debugger:

[17:34:41.757] Pastebin[Universal Action] Processing complete
[17:34:41.763] Pastebin[Universal Action] Passing output '<?php

print( '<pre>' . print_r( tribe_get_custom_fields(), true ) . '</pre>' );

?>' to Run Script
[17:34:41.873] ERROR: Pastebin[Run Script] Traceback (most recent call last):
  File "/Users/sridharkatakam/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A74E130-3478-489E-81CA-433F05ADDF24/script.py", line 13, in <module>
    get_paste_result()
  File "/Users/sridharkatakam/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A74E130-3478-489E-81CA-433F05ADDF24/alfred_pastebin/functions.py", line 165, in get_paste_result
    response = create_paste(
  File "/Users/sridharkatakam/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A74E130-3478-489E-81CA-433F05ADDF24/alfred_pastebin/functions.py", line 80, in create_paste
    api_user_key = get_api_user_key()
  File "/Users/sridharkatakam/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A74E130-3478-489E-81CA-433F05ADDF24/alfred_pastebin/functions.py", line 52, in get_api_user_key
    response = urllib.urlopen(API_ENDPOINT + 'api_login.php', data=urllib.urlencode(payload))
AttributeError: module 'urllib' has no attribute 'urlopen'
[17:34:41.885] Pastebin[Run Script] Processing complete
[17:34:41.887] Pastebin[Run Script] Passing output '' to Conditional
[17:34:41.889] Pastebin[Conditional] Processing complete
[17:34:41.891] Pastebin[Conditional] Passing output '' to Post Notification

I've put my details in the Environment Variables tab.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.