Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- The MIT License (MIT)
- Copyright (c) 2014 sinfonier-project
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- """
- import basesinfonierdrain
- import requests
- import urllib
- import os
- import csv
- import requests
- import json
- from base64 import b64encode
- class OrientDBCreatingEdge(basesinfonierdrain.BaseSinfonierDrain):
- def __init__(self):
- basesinfonierdrain.BaseSinfonierDrain().__init__()
- def userprepare(self):
- self.raids = self.getParam("raids")
- self.name_database = self.getParam("name_database")
- # catching url_database = "url:port". Usually port = 2480
- self.url_database = self.getParam("url_database")
- if self.existsField("user")
- self.user = self.getParam("user")
- if self.existsField("password")
- self.password = self.getParam("password")
- def userprocess(self):
- try:
- # creating headers
- user_password = self.user + ":" + self.password
- user_and_pass = b64encode("user_password").decode("ascii")
- headers = { 'Authorization' : 'Basic %s' % user_and_pass }
- # creating Edge POST with SQL
- content = { "class":ASDASD, "command":"create edge ASDASD from (select from ASDASD where @rid=ASDASD) to (select from ASDASD where @rid=ASDASD)" }
- except Exception, ex:
- self.log("ERROR is comming : " + str(ex))
- OrientDBCreatingEdge().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement