import os

current_dir = os.getcwd()

print (current_dir)

import time

#create new folder
print ('Create new folder in directory')
os.mkdir('NewFolder')
time.sleep(3)

#rename folder
print ('Rename folder')
os.rename('NewFolder', 'NewFolderChange')
time.sleep(3)
#delete folder
print ('Delete folder')
os.rmdir('NewFolderChange')


#sys module
import sys

sys.stderr.write('This is stderr text\n')
sys.stderr.flush()
print (sys.argv)

import urllib.request
#x = urllib.request.urlopen('https://www.google.pl')
#print (x.read())

import urllib.parse

url = 'http://pythonprogramming.net'
values =  {'s': 'basic','submit':'search'}

data = urllib.parse.urlencode(values)
data = data.encode('utf-8')
req = urllib.request.Request(url,data)
resp = urllib.request.urlopen(req)
respData = resp.read()

print (respData)

#

try:
	url = 'https://google.com/search?q=test'
	headers = {}
	headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'
	req = urllib.request.Request(url, headers = headers)
	resp = urllib.request.urlopen(req)
	respData = resp.read()
	
	saveFile = open('withHeaders.txt', 'w')
	saveFile.write(str(respData))
	saveFile.close()
	
except Exception as e:
	print (e)
	

	
 