-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·68 lines (60 loc) · 1.9 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='Product Scraper',
version='1.0',
description='Specific Product Scraper',
author='James Munsch',
author_email='[email protected]',
url='http://jamesmunsch.com/',
install_requires=[
"PyYAML>=3.11",
"beautifulsoup4>=4.3.2",
"html5lib>=0.999",
"six>=1.8.0",
"urllib3>=1.9.1",
"ShopifyAPI>=2.1.0",
"paramiko",
],
dependency_links = ['https://github.com/Shopify/shopify_python_api/tarball/master#egg=shopify'],
)
import paramiko
import traceback
from getpass import getpass
class SshGetKeys(object):
def __init__(self):
super(SshGetKeys, self).__init__()
self.getKeys()
def setup(self):
'''Setup connection'''
try:
print("\n\n########\nPlease enter the dev server login info found in keepass to pull shopify api keys.\n")
self.username = input("Username: ")
password = getpass("Password: ")
host = "192.168.0.2"
port = 22
self.transport = paramiko.Transport((host, port))
self.transport.connect(username = self.username, password = password)
self.sftp = paramiko.SFTPClient.from_transport(self.transport)
print(self.sftp.sock)
except Exception as e:
print(traceback.format_exc())
return False
def getKeys(self):
'''
'''
self.setup()
try:
self.sftp.get("/home/"+self.username+"/Desktop/shopify_keys.json", "../shopify_keys.json")
except Exception as e:
print(traceback.format_exc())
self.close()
return True
def close(self):
''' Close the connection '''
self.sftp.close()
self.transport.close()
return
SshGetKeys()