A Pen by Fabrizio Giordano on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #sudo apt-get install libmysqlclient-dev | |
| #pip install mysqlclient | |
| import csv | |
| import MySQLdb | |
| import tensorflow as tf | |
| mydb = MySQLdb.connect(host='localhost', | |
| user='root', | |
| passwd='root') | |
| cursor = mydb.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| class Authorization: | |
| def __init__(self, username, password, company_uid): | |
| self.username = username | |
| self.password = password | |
| self.company_uid = company_uid | |
| def token(self): | |
| url = "https://api.domain.com/3.0/login/?username=" + self.username + "&password=" + self.password + "&company_uid=" + self.company_uid + "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3.7 | |
| # -*- coding: utf-8 -*- | |
| __author__ = "Michele Berardi" | |
| __copyright__ = "Copyright 2020" | |
| __license__ = "GPL" | |
| __version__ = "1.0.8" | |
| __maintainer__ = "Michele Berardi" | |
| __email__ = "[email protected]" | |
| __status__ = "Production" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import os | |
| import subprocess | |
| import requests | |
| def is_service_running(name): | |
| with open(os.devnull, 'wb') as hide_output: | |
| exit_code = subprocess.Popen(['service', name, 'status'], stdout=hide_output, stderr=hide_output).wait() | |
| return exit_code == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from modules import defines | |
| import ndjson | |
| from google.cloud import bigquery | |
| import pymysql | |
| database = pymysql.connect(host='IP', user='USER', passwd='PWD', db='DB_NAME',use_unicode=True, cursorclass=pymysql.cursors.DictCursor, charset="utf8") | |
| def select_exe(query_select): | |
| mydb = pymysql.connect(host='IP', user='USER', passwd='PWD', db='DB_NAME',use_unicode=True, cursorclass=pymysql.cursors.DictCursor, charset="utf8") | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "product_metadata", | |
| "type": "RECORD", | |
| "mode": "NULLABLE", | |
| "fields": [ | |
| { | |
| "name": "images", | |
| "type": "RECORD", | |
| "mode": "REPEATED", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"id": sku,"categories":categories],"title":description,"priceInfo":[{"currencyCode":"USD"},{"price":float(exact_price)},{"originalPrice":float(exact_price)},{"cost":float(exact_price)}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gcloud scheduler --project micheleone \ | |
| jobs create http import_catalog_xmq5ynl8i2i \ | |
| --time-zone='America/Los_Angeles' \ | |
| --schedule='0 0 * * *' \ | |
| --uri='https://retail.googleapis.com/v2alpha/projects/***********/locations/global/catalogs/default_catalog/branches/1/products:import' \ | |
| --description='Import Retail catalog data' \ | |
| --headers='Content-Type: application/json; charset=utf-8' \ | |
| --http-method='POST' \ | |
| --message-body='{"inputConfig":{"bigQuerySource":{"projectId":"project-id","datasetId":"retail","tableId":"catalog","dataSchema":"product"}},"reconciliationMode":"INCREMENTAL"}' \ | |
| --oauth-service-account-email='' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| def get_url(instagram_profile_id,instagram_token): | |
| url = "https://graph.facebook.com/v14.0/"+str(instagram_profile_id)+"/media?fields=id%2Ccaption%2Cis_comment_enabled%2Ccomments_count%2Clike_count%2Cmedia_type%2Cmedia_url%2Cpermalink&access_token="+str(instagram_token) | |
| r = requests.get(url) | |
| return r.json() |