Browse Source

moses.rivera: First push.

master
moses.rivera 1 year ago
commit
a9dcfa9f04
7 changed files with 96 additions and 0 deletions
  1. 2
    0
      .idea/.gitignore
  2. 6
    0
      .idea/inspectionProfiles/profiles_settings.xml
  3. 7
    0
      .idea/misc.xml
  4. 8
    0
      .idea/modules.xml
  5. 13
    0
      .idea/python.getloop.iml
  6. 6
    0
      .idea/vcs.xml
  7. 54
    0
      getloop.py

+ 2
- 0
.idea/.gitignore View File

@@ -0,0 +1,2 @@
1
+# Default ignored files
2
+/workspace.xml

+ 6
- 0
.idea/inspectionProfiles/profiles_settings.xml View File

@@ -0,0 +1,6 @@
1
+<component name="InspectionProjectProfileManager">
2
+  <settings>
3
+    <option name="USE_PROJECT_PROFILE" value="false" />
4
+    <version value="1.0" />
5
+  </settings>
6
+</component>

+ 7
- 0
.idea/misc.xml View File

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
7
+</project>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/python.getloop.iml" filepath="$PROJECT_DIR$/.idea/python.getloop.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 13
- 0
.idea/python.getloop.iml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="PYTHON_MODULE" version="4">
3
+  <component name="NewModuleRootManager">
4
+    <content url="file://$MODULE_DIR$">
5
+      <excludeFolder url="file://$MODULE_DIR$/venv" />
6
+    </content>
7
+    <orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" />
8
+    <orderEntry type="sourceFolder" forTests="false" />
9
+  </component>
10
+  <component name="TestRunnerService">
11
+    <option name="PROJECT_TEST_RUNNER" value="Unittests" />
12
+  </component>
13
+</module>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 54
- 0
getloop.py View File

@@ -0,0 +1,54 @@
1
+#!/usr/bin/python3.6
2
+
3
+# imports.
4
+import requests
5
+
6
+
7
+# Variables.
8
+number = 0
9
+url = ''
10
+
11
+
12
+# Start.
13
+def start():
14
+    global url
15
+    global number
16
+    url = input('Input URL: ')
17
+    if url == '':
18
+        print('Error: Please enter an valid URL.')
19
+    inputNumber = input('Input number of requests: ')
20
+    if not isNumber(inputNumber):
21
+        print('Error: Please enter an valid number.')
22
+        start()
23
+    number = int(inputNumber)
24
+    run()
25
+
26
+
27
+# Run.
28
+def run():
29
+    global url
30
+    global number
31
+    print('Start Requests')
32
+    index = 0
33
+    while index < number:
34
+        request = requests.get(url=url)
35
+        index += 1
36
+        if request.status_code != 200:
37
+            print ('Error: Wrong response ( Status code: ', request, ' ).')
38
+            start()
39
+        print('Request:', index)
40
+    print('End Requests')
41
+    start()
42
+
43
+
44
+# If variable is a number.
45
+def isNumber(value):
46
+    try:
47
+        float(value)
48
+        return True
49
+    except ValueError:
50
+        return False
51
+
52
+
53
+# Start.
54
+start()

Loading…
Cancel
Save