Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def callback_converter(ch, method, properties, body):
- json_get = json.loads(body)
- file_path = json_get['file_path']
- print file_path
- response = requests.get(file_path)
- content_type = response.headers['content-type']
- extension = mimetypes.guess_extension(content_type)
- hash = uuid.uuid4().hex
- fullPath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + '/converter-node/files/' + hash + extension
- with open(fullPath, 'wb') as f:
- f.write(response.content)
- connector = Connection(host='35.198.191.27', login='prosperodesu', password='s45fdfx65')
- connector.addCallback('convert', callback_converter)
- connector.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement