Skip to content

Commit f01c109

Browse files
author
pgaref
committed
Updating example to Python3 style
1 parent 014b36a commit f01c109

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ if __name__ == '__main__':
4545

4646
start = time.time()
4747
req_proxy = RequestProxy()
48-
print "Initialization took: {0} sec".format((time.time() - start))
49-
print "Size : ", len(req_proxy.get_proxy_list())
50-
print " ALL = ", req_proxy.get_proxy_list()
48+
print("Initialization took: {0} sec".format((time.time() - start)))
49+
print("Size: {0}".format(len(req_proxy.get_proxy_list())))
50+
print("ALL = {0} ".format(req_proxy.get_proxy_list()))
5151

5252
test_url = 'http://ipv4.icanhazip.com'
5353

5454
while True:
5555
start = time.time()
5656
request = req_proxy.generate_proxied_request(test_url)
57-
print "Proxied Request Took: {0} sec => Status: {1}".format((time.time() - start), request.__str__())
57+
print("Proxied Request Took: {0} sec => Status: {1}".format((time.time() - start), request.__str__()))
5858
if request is not None:
59-
print "\t Response: ip={0}".format(u''.join(request.text).encode('utf-8'))
60-
print "Proxy List Size: ", len(req_proxy.get_proxy_list())
59+
print("\t Response: ip={0}".format(u''.join(request.text).encode('utf-8')))
60+
print("Proxy List Size: {0}".format(len(req_proxy.get_proxy_list())))
6161

62-
print"-> Going to sleep.."
62+
print("-> Going to sleep..")
6363
time.sleep(10)
6464
````
6565

README.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ How to use
5252
----------
5353

5454
The project is now distribured as a PyPI package! To run an example
55-
simply include **http-request-randomizer** in your
56-
requirements.txt file. Then run the code below:
55+
simply include **http-request-randomizer** in your requirements.txt
56+
file. Then run the code below:
5757

5858
.. code:: python
5959
@@ -64,21 +64,21 @@ requirements.txt file. Then run the code below:
6464
6565
start = time.time()
6666
req_proxy = RequestProxy()
67-
print "Initialization took: {0} sec".format((time.time() - start))
68-
print "Size : ", len(req_proxy.get_proxy_list())
69-
print " ALL = ", req_proxy.get_proxy_list()
67+
print("Initialization took: {0} sec".format((time.time() - start)))
68+
print("Size: {0}".format(len(req_proxy.get_proxy_list())))
69+
print("ALL = {0} ".format(req_proxy.get_proxy_list()))
7070
7171
test_url = 'http://ipv4.icanhazip.com'
7272
7373
while True:
7474
start = time.time()
7575
request = req_proxy.generate_proxied_request(test_url)
76-
print "Proxied Request Took: {0} sec => Status: {1}".format((time.time() - start), request.__str__())
76+
print("Proxied Request Took: {0} sec => Status: {1}".format((time.time() - start), request.__str__()))
7777
if request is not None:
78-
print "\t Response: ip={0}".format(u''.join(request.text).encode('utf-8'))
79-
print "Proxy List Size: ", len(req_proxy.get_proxy_list())
78+
print("\t Response: ip={0}".format(u''.join(request.text).encode('utf-8')))
79+
print("Proxy List Size: {0}".format(len(req_proxy.get_proxy_list())))
8080
81-
print"-> Going to sleep.."
81+
print("-> Going to sleep..")
8282
time.sleep(10)
8383
8484
Documentation

0 commit comments

Comments
 (0)