Ejemplo n.º 1
0
def geoLocation(s):
    global geo
    from ipregistry import IpregistryClient
    client = IpregistryClient("tryout")
    ipInfo = client.lookup()
    print(geo.latlng)
    print(ipInfo)
    geoinfo = '[1] cords: {}\n[2] RAW_cords: \n{}'.format(
        str(geo.latlng), str(ipInfo))
    s.send(geoinfo.encode())
Ejemplo n.º 2
0
"""
    Copyright 2019 Ipregistry (https://ipregistry.co).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from ipregistry import ApiError, ClientError, IpregistryClient

try:
    apiKey = "tryout"
    client = IpregistryClient(apiKey)
    ipInfo = client.lookup()
    print(ipInfo)
except ApiError as e:
    print("API error", e)
except ClientError as e:
    print("Client error", e)
except Exception as e:
    print("Unexpected error", e)
Ejemplo n.º 3
0
from ipregistry import IpregistryClient

client = IpregistryClient("tryout")
ipInfo = client.lookup()
print(ipInfo)
    Copyright 2019 Ipregistry (https://ipregistry.co).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from ipregistry import ApiError, ClientError, IpregistryClient

try:
    apiKey = "tryout"
    client = IpregistryClient(apiKey)
    ipInfo = client.lookup("54.85.132.205",
                           hostname=True,
                           fields="location.country")
    print(ipInfo)
except ApiError as e:
    print("API error", e)
except ClientError as e:
    print("Client error", e)
except Exception as e:
    print("Unexpected error", e)
Ejemplo n.º 5
0
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from ipregistry import ApiError, ClientError, IpInfo, IpregistryClient, LookupError

try:
    apiKey = "tryout"
    client = IpregistryClient(apiKey)
    ipInfoList = client.lookup(["73.2.2.2", "8.8.8.8", "2001:67c:2e8:22::c100:68b"])

    for lookupResult in ipInfoList:
        if isinstance(lookupResult, IpInfo):
            print("IpInfo", lookupResult)
        else:
            print("LookupError", lookupResult)
except ApiError as e:
    print("API error", e)
except ClientError as e:
    print("Client error", e)
except Exception as e:
    print("Unexpected error", e)
"""
    Copyright 2019 Ipregistry (https://ipregistry.co).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from ipregistry import ApiError, ClientError, IpregistryClient, NoCache

try:
    apiKey = "tryout"
    client = IpregistryClient(apiKey, cache=NoCache())
    ipInfo = client.lookup("54.85.132.205")
    print(ipInfo)
except ApiError as e:
    print("API error", e)
except ClientError as e:
    print("Client error", e)
except Exception as e:
    print("Unexpected error", e)
Ejemplo n.º 7
0
"""
    Copyright 2019 Ipregistry (https://ipregistry.co).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from ipregistry import ApiError, ClientError, IpregistryClient

try:
    apiKey = "tryout"
    client = IpregistryClient(apiKey)
    ipInfo = client.lookup("54.85.132.205")
    print(ipInfo)
except ApiError as e:
    print("API error", e)
except ClientError as e:
    print("Client error", e)
except Exception as e:
    print("Unexpected error", e)