File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 2
2
import mysql .connector
3
3
import os
4
4
import subprocess
5
- import requests
5
+ import requests
6
6
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 ())
7
12
f = os .popen ('date' )
8
13
now = f .read ()
9
14
print ("Today is " , now )
10
- subprocess .call (["cat" , "/etc/resolv.conf" ])
11
- ###MySQL###
12
15
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###
13
24
# import mysql.connector
14
- #
15
25
# from mysql.connector import errorcode
16
- #
17
26
# try:
18
27
# cnx = mysql.connector.connect(user='scott',
19
28
# database='employ')
27
36
# else:
28
37
# cnx.close()
29
38
30
- Home_Dir = / Users / peshal / Downloads
39
+ # Home_Dir = /Users/peshal/Downloads
31
40
32
41
33
42
You can’t perform that action at this time.
0 commit comments