init

swadhingithub committed 2 years ago
9a08764
1 parent ddb2c19
commit 9a08764
9 files changed
+62 -0
▼IpStack.egg-info/PKG-INFO
+3-0
1
+Metadata-Version: 2.1
2
+Name: IpStack
3
+Version: 1.0
0
4
▼IpStack.egg-info/SOURCES.txt
+9-0
1
+README.md
2
+setup.py
3
+IpStack/__init__.py
4
+IpStack/main.py
5
+IpStack.egg-info/PKG-INFO
6
+IpStack.egg-info/SOURCES.txt
7
+IpStack.egg-info/dependency_links.txt
8
+IpStack.egg-info/requires.txt
9
+IpStack.egg-info/top_level.txt
0
10
▼IpStack.egg-info/dependency_links.txt
+1-0
1
+
0
2
▼IpStack.egg-info/requires.txt
+1-0
1
+requests
0
2
▼IpStack.egg-info/top_level.txt
+1-0
1
+IpStack
0
2
▼build/lib/IpStack/__init__.py
+2-0
1
+#__init__.py
2
+from .main import IpStack
0
3
▼build/lib/IpStack/main.py
+45-0
1
+import requests
2
+
3
+class IpStack():
4
+ def __init__(self,ipaddress,apikey,*args,**kwerrgs):
5
+ self.ipaddress=ipaddress
6
+ self.apikey=apikey
7
+ self.url=f"http://api.ipstack.com/{ipaddress}?access_key={apikey}&en"
8
+ self.function=args
9
+
10
+ def get_Apicall(self):
11
+ api=requests.get(self.url).json()
12
+ return api
13
+
14
+
15
+ def getlocation(self):
16
+ api=self.get_Apicall()
17
+ return api["location"]
18
+
19
+ def hostname_lookup(self):
20
+ lurl=f"{self.url}&hostname=1"
21
+ api=requests.get(lurl).json()
22
+ return api
23
+
24
+ def api_xmlformat(self):
25
+ url_xml=f"{self.url}&output=xml"
26
+ api=requests.get(url_xml)
27
+ dict_data=api.content
28
+ return dict_data
29
+
30
+ def callby_function(self,function):
31
+ urlx=f"{self.url}&callback={function}&json"
32
+ txt=requests.get(urlx).text
33
+ import json
34
+ # api=json.loads(txt)
35
+ return txt
36
+
37
+ def enable_security_apicall(self):
38
+ secureurl=f"{self.url}&security=1"
39
+ api=requests.get(secureurl).json()
40
+ return api
41
+
42
+ def callby_fields(self,kwerrgs):
43
+ url=f"{self.url}&fields={kwerrgs}"
44
+ api=requests.get(url).json()
45
+ return api
0
46
▼dist/IpStack-1.0-py3-none-any.whl
+0-0
Binary file not shown.
▼dist/IpStack-1.0.tar.gz
+0-0
Binary file not shown.