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
private void parseXML(String targetFilePath) { | |
try { | |
FileInputStream is = new FileInputStream(targetFilePath); | |
XmlToJson xmlToJson = new XmlToJson.Builder(is, null).build(); | |
JSONObject jsonObject = xmlToJson.toJson(); | |
Timber.d("Content " + jsonObject.toString()); | |
// get the root key. | |
// This prevents us from manually checking key. This is a special case | |
Iterator keys = jsonObject.keys(); |
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
private String getFileContent(String targetFilePath) { | |
try { | |
FileInputStream fis = new FileInputStream(targetFilePath); | |
DataInputStream in = new DataInputStream(fis); | |
BufferedReader br = new BufferedReader(new InputStreamReader(in)); | |
String strLine; | |
StringBuilder sb = new StringBuilder(); | |
while ((strLine = br.readLine()) != null) | |
sb.append(strLine); | |
Timber.d("form data"); |
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 json | |
from run import app | |
import pytest | |
@pytest.fixture() | |
def client(): | |
test_client = app.test_client() | |
return test_client |
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
print('list, string, tuple, dict, sets') | |
print('########### LISTS #############') | |
tasks = [474,837,8675,636,86,976,23,4] | |
print(tasks) | |
tasks.append(100) | |
print(tasks) | |
print(len(tasks)) |
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
#!/bin/bash | |
## Modification of https://almcc.me/blog/2017/05/04/removing-older-versions-on-google-app-engine/ | |
## to allow deletion of of old app versions, leaving only version per service | |
## define all your services | |
declare -a arr=("default" "sellio-clients" "ad-manager" "sellio-test" "unified-bot" "momo" "healthcheck") | |
echo 'started' | |
## now loop through the above array | |
for i in "${arr[@]}" |
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 mysql.connector | |
mydb = mysql.connector.connect( | |
host="127.0.0.1", | |
user="root", | |
passwd="XXXXXX" | |
) | |
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
curl \ | |
-X POST \ | |
-H "Content-Type: application/json" \ | |
--data '{"query": "{links {url}}"}' \ | |
http:///35.227.57.118/graphql/ |
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 | |
r = requests.post(url='http://35.227.57.118/graphql/', json={"query": "{links {url}}"}) | |
print(r.status_code) | |
print(r.content) | |
if r.status_code == 200 or r.status_code == 201: | |
r_json = r.json() | |
data = r_json['data'] | |
links = data['links'] |
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 | |
import DotMap | |
from httplib import OK | |
import logging | |
def get_accounts_no_meta_data(): | |
""" | |
https://app.beyonic.com/api/collectionrequests -H "Authorization: Token XXXX" | |
beyonic collection requests that dont have meta field | |
""" |