def connect(): cnx = pg.connect( user=get_secrets("postgres_username"), password=get_secrets("postgres_db_pwd"), host="localhost", database="testing") cnx.set_session(autocommit=True) return cnx
def init_scraper(): # get all of our validation tokens. You don't get to see them conkey,consecret,acctok,acctoksecret = secrets.get_secrets() auth1 = tweepy.auth.OAuthHandler(conkey, consecret) auth1.set_access_token(acctok, acctoksecret) api = tweepy.API(auth1) l = StreamListener() streamer = tweepy.Stream(auth=auth1, listener=l, timeout=None) searchTerms = [key for key in validation.command_templates] searchTerms.extend(colors.colors) streamer.filter(None, searchTerms)
def key_init(): global gpg # secrets key_id, passphrase, public_key, private_key = get_secrets() key_data = f'{public_key}\n{private_key}' # print(key_data) imported = gpg.import_keys(key_data) print(imported.fingerprints) return key_id, passphrase
def validate_committed_files(branch_name, is_circle): secrets_found, secrets_found_string = secrets.get_secrets(branch_name, is_circle) if secrets_found_string: print_error(secrets_found_string) modified_files, added_files = get_modified_and_added_files(branch_name, is_circle) with open('./Tests/id_set.json', 'r') as id_set_file: try: id_set = json.load(id_set_file) except ValueError, ex: if "Expecting property name" in ex.message: print_error("You probably merged from master and your id_set.json has conflicts. " "Run `python Tests/scripts/update_id_set.py -r`, it should reindex your id_set.json") return else: raise ex
def main(): (api_key, client_secret) = secrets.get_secrets() shop_id = 'PlannerBunnyPress' api = EtsyAPI(api_key=api_key) auth = authentication.get_oauth(api, api_key, client_secret, app_permissions) print("getting all receipts...") receipts = get_unsatisfied_receipts(api, auth, shop_id) print("getting all transactions...") transactions = get_transactions_for_receipts(api, auth, receipts) transactions = remove_digital_printable_transactions(transactions) pick_list = {} print("looking through transactions...") for transaction in transactions: item = make_item_type_for_transaction(transaction) pick_list[item] = pick_list.setdefault(item, 0) + transaction['quantity'] pp.pprint(pick_list)
def connect(): return psycopg2.connect(user=get_secrets("postgres_username"), password=get_secrets("postgres_db_pwd"), host="localhost", database="dvdrental")
from flask import Flask, redirect, url_for, session, request from flask_oauth import OAuth SECRET_KEY = "development key" DEBUG = True import secrets as sec secrets = sec.get_secrets() FACEBOOK_APP_ID = secrets["FACEBOOK_APP_ID"] FACEBOOK_APP_SECRET = secrets["FACEBOOK_APP_SECRET"] app = Flask(__name__) app.debug = DEBUG app.secret_key = SECRET_KEY oauth = OAuth() facebook = oauth.remote_app( "facebook", base_url="https://graph.facebook.com/", request_token_url=None, access_token_url="/oauth/access_token", authorize_url="https://www.facebook.com/dialog/oauth", consumer_key=FACEBOOK_APP_ID, consumer_secret=FACEBOOK_APP_SECRET, request_token_params={"scope": "email"}, ) @app.route("/") def index():