This repository has been archived by the owner on Feb 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to requests and certifi for http reqs
- Loading branch information
1 parent
e34653b
commit 8d82109
Showing
109 changed files
with
35,799 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .core import where, old_where | ||
|
||
__version__ = "2018.01.18" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from certifi import where | ||
print(where()) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
certifi.py | ||
~~~~~~~~~~ | ||
This module returns the installation location of cacert.pem. | ||
""" | ||
import os | ||
import warnings | ||
|
||
|
||
class DeprecatedBundleWarning(DeprecationWarning): | ||
""" | ||
The weak security bundle is being deprecated. Please bother your service | ||
provider to get them to stop using cross-signed roots. | ||
""" | ||
|
||
|
||
def where(): | ||
f = os.path.dirname(__file__) | ||
|
||
return os.path.join(f, 'cacert.pem') | ||
|
||
|
||
def old_where(): | ||
warnings.warn( | ||
"The weak security bundle has been removed. certifi.old_where() is now an alias " | ||
"of certifi.where(). Please update your code to use certifi.where() instead. " | ||
"certifi.old_where() will be removed in 2018.", | ||
DeprecatedBundleWarning | ||
) | ||
return where() | ||
|
||
if __name__ == '__main__': | ||
print(where()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
######################## BEGIN LICENSE BLOCK ######################## | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
# 02110-1301 USA | ||
######################### END LICENSE BLOCK ######################### | ||
|
||
|
||
from .compat import PY2, PY3 | ||
from .universaldetector import UniversalDetector | ||
from .version import __version__, VERSION | ||
|
||
|
||
def detect(byte_str): | ||
""" | ||
Detect the encoding of the given byte string. | ||
:param byte_str: The byte sequence to examine. | ||
:type byte_str: ``bytes`` or ``bytearray`` | ||
""" | ||
if not isinstance(byte_str, bytearray): | ||
if not isinstance(byte_str, bytes): | ||
raise TypeError('Expected object of type bytes or bytearray, got: ' | ||
'{0}'.format(type(byte_str))) | ||
else: | ||
byte_str = bytearray(byte_str) | ||
detector = UniversalDetector() | ||
detector.feed(byte_str) | ||
return detector.close() |
Oops, something went wrong.