removed pyperclip hard dependencies
This commit is contained in:
parent
8e1f260150
commit
f21a44dd48
|
@ -1,10 +1,8 @@
|
|||
language: python
|
||||
sudo: true
|
||||
sudo: false
|
||||
python:
|
||||
- "2.7"
|
||||
- pypy
|
||||
before_install:
|
||||
- "sudo apt-get install -y xclip"
|
||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||
install:
|
||||
- "pip install --upgrade --src . -r requirements.txt"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from __future__ import absolute_import
|
||||
import urwid
|
||||
import pyperclip
|
||||
from . import common
|
||||
try:
|
||||
import pyperclip
|
||||
except:
|
||||
pyperclip = False
|
||||
|
||||
def _mkhelp():
|
||||
text = []
|
||||
|
@ -141,16 +144,19 @@ class ConnectionItem(common.WWrap):
|
|||
self.master.server_playback_path
|
||||
)
|
||||
def server_copy_response(self, k):
|
||||
if k == "c":
|
||||
try:
|
||||
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||
elif k == "h":
|
||||
try:
|
||||
pyperclip.copy(str(self.flow.response.headers))
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Error converting headers to text")
|
||||
if pyperclip:
|
||||
if k == "c":
|
||||
try:
|
||||
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||
elif k == "h":
|
||||
try:
|
||||
pyperclip.copy(str(self.flow.response.headers))
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Error converting headers to text")
|
||||
else:
|
||||
self.master.statusbar.message("No clipboard support on your system, sorry.")
|
||||
|
||||
def keypress(self, (maxcol,), key):
|
||||
key = common.shortcuts(key)
|
||||
|
|
|
@ -4,7 +4,10 @@ import urwid
|
|||
from . import common, grideditor, contentview
|
||||
from .. import utils, flow, controller
|
||||
from ..protocol.http import HTTPResponse, CONTENT_MISSING, decoded
|
||||
import pyperclip
|
||||
try:
|
||||
import pyperclip
|
||||
except:
|
||||
pyperclip = False
|
||||
|
||||
class SearchError(Exception): pass
|
||||
|
||||
|
@ -650,16 +653,19 @@ class FlowView(common.WWrap):
|
|||
self.master.refresh_flow(self.flow)
|
||||
|
||||
def server_copy_response(self, k):
|
||||
if k == "c":
|
||||
try:
|
||||
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||
elif k == "h":
|
||||
try:
|
||||
pyperclip.copy(str(self.flow.response.headers))
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Error converting headers to text")
|
||||
if pyperclip:
|
||||
if k == "c":
|
||||
try:
|
||||
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||
elif k == "h":
|
||||
try:
|
||||
pyperclip.copy(str(self.flow.response.headers))
|
||||
except TypeError:
|
||||
self.master.statusbar.message("Error converting headers to text")
|
||||
else:
|
||||
self.master.statusbar.message("No clipboard support on your system, sorry.")
|
||||
|
||||
def delete_body(self, t):
|
||||
if t == "m":
|
||||
|
|
Loading…
Reference in New Issue