starofrainnight / ipgetter2 Goto Github PK
View Code? Open in Web Editor NEWUtility to fetch your external IP address. A replacement of the ipgetter library
License: Apache License 2.0
Utility to fetch your external IP address. A replacement of the ipgetter library
License: Apache License 2.0
ip = IPGetter().get()
which leads to
Traceback (most recent call last):
File "/etc/nginx/update-cloudflare-dns.py", line 10, in <module>
ip = IPGetter().get()
File "/usr/local/lib/python3.5/dist-packages/ipgetter2/ipgetter2.py", line 304, in get
urls = random.choices(list(rest_urls), k=batch_size)
AttributeError: module 'random' has no attribute 'choices'
It would appear that random.choices
is not present on Python 3.5.
http://www.taobao.com/help/getip.php
return taobao callback ip not client ip
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
pip install error
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
https://bugs.python.org/issue31652
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
I have a script, which fetches my IP address from ipgetter2, to be used with geolite. Once in a while, the script crashes at line 212 of ipgetter2.py in function "get_from()"
Paste the command(s) you ran and the output.
from ipgetter2 import IPGetter
getter = IPGetter()
myIPObj = getter.get()
myIP = myIPObj.v4.compressed
If there was a crash, please include the traceback here.
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/advention/.local/lib/python3.6/site-packages/ipgetter2/ipgetter2.py", line 252, in fetch_address_thread
address = self.get_from(url)
File "/home/advention/.local/lib/python3.6/site-packages/ipgetter2/ipgetter2.py", line 212, in get_from
if guessed["encoding"].upper() == "GB2312":
AttributeError: 'NoneType' object has no attribute 'upper'
I believe adding a try/except block might resolve the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.