- Notifications
You must be signed in to change notification settings - Fork145
Removing unused dependency, adding optional dependencies and loosening requests version#104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -27,12 +27,21 @@ | ||||||
| importipaddress | ||||||
| importjson | ||||||
| importsys | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| fromtypingimportAny,Dict,cast,List,Optional,Type,Union | ||||||
| try: | ||||||
| importaiohttp | ||||||
| importaiohttp.http | ||||||
| exceptImportError: | ||||||
| pass | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| try: | ||||||
| importrequests | ||||||
| importrequests.utils | ||||||
| exceptImportError: | ||||||
| pass | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| importgeoip2 | ||||||
| importgeoip2.models | ||||||
| @@ -48,13 +57,28 @@ | ||||||
| fromgeoip2.modelsimportCity,Country,Insights | ||||||
| fromgeoip2.typesimportIPAddress | ||||||
| # If neither requests or aiohttp is installed then inform user how to | ||||||
| # install them | ||||||
| if"aiohttp"notinsys.modulesand"requests"notinsys.modules: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| raiseImportError( | ||||||
| """To enable geoip2.webservice, | ||||||
| install aiohttp or requests support. | ||||||
| pip install geoip2[aiohttp] | ||||||
| pip install geoip2[requests] | ||||||
| pip install geoip2[all]""" | ||||||
| ) | ||||||
| if"aiohttp"insys.modules: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| _AIOHTTP_UA= ( | ||||||
| f"GeoIP2-Python-Client/{geoip2.__version__}{aiohttp.http.SERVER_SOFTWARE}" | ||||||
| ) | ||||||
| if"requests"insys.modules: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| _REQUEST_UA= ( | ||||||
| f"GeoIP2-Python-Client/{geoip2.__version__}" | ||||||
| f"{requests.utils.default_user_agent()}" | ||||||
| ) | ||||||
| classBaseClient:# pylint: disable=missing-class-docstring, too-few-public-methods | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1 @@ | ||
| maxminddb>=2.0.0,<3.0.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,3 +23,5 @@ deps = | ||
| pytest | ||
| mocket | ||
| commands = pytest tests | ||
| usedevelop = true | ||
| extras = aiohttp, requests | ||