Skip to content

Commit aff22ef

Browse files
committed
save1
1 parent a99145a commit aff22ef

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Test.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22
import mysql.connector
33
import os
44
import subprocess
5-
import requests
5+
import requests
66
import sys
7+
# response = requests.get("http://api.open-notify.org/this-api-doesnt-exist")
8+
# print(response.status_code)
9+
response = requests.get("http://api.open-notify.org/astros.json")
10+
print(response.status_code)
11+
print(response.json())
712
f = os.popen('date')
813
now = f.read()
914
print ("Today is ", now)
10-
subprocess.call(["cat", "/etc/resolv.conf"])
11-
###MySQL###
1215

16+
import json
17+
def jprint(obj):
18+
# create a formatted string of the Python JSON object
19+
text = json.dumps(obj, sort_keys=True, indent=4)
20+
print(text)
21+
jprint(response.json())
22+
#subprocess.call(["cat", "/etc/resolv.conf"])
23+
###MySQL###
1324
# import mysql.connector
14-
#
1525
# from mysql.connector import errorcode
16-
#
1726
# try:
1827
# cnx = mysql.connector.connect(user='scott',
1928
# database='employ')
@@ -27,7 +36,7 @@
2736
# else:
2837
# cnx.close()
2938

30-
Home_Dir = /Users/peshal/Downloads
39+
#Home_Dir = /Users/peshal/Downloads
3140

3241

3342

0 commit comments

Comments
 (0)