This file contains hidden or 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
class LowerCaseJSONDecoder(JSONDecoder): | |
def _lower_keys(self, obj): | |
new = {} | |
for k, v in obj.items(): | |
if isinstance(v, dict): | |
v = self._lower_keys(v) | |
new[k.lower()] = v | |
return new |
This file contains hidden or 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
[[source]] | |
url = 'https://pypi.python.org/simple' | |
verify_ssl = true | |
[requires] | |
python_version = '3.6' | |
[packages] | |
flask = "*" | |
boto3 = ">=1.4" |
This file contains hidden or 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
$ pipenv check | |
Checking PEP 508 requirements… | |
Passed! | |
Checking installed package safety… | |
33300: django >=1.10,<1.10.7 resolved (1.10.1 installed)! | |
CVE-2017-7233: Open redirect and possible XSS attack via user-supplied numeric redirect URLs | |
============================================================================================ | |
Django relies on user input in some cases (e.g. |
This file contains hidden or 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
$ cat .env | |
API_KEY=supersecretstuff | |
$ pipenv run python | |
Loading .env environment variables… | |
Python 3.6.3 (default, Oct 4 2017, 06:09:15) | |
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import os | |
>>> os.getenv['API_KEY'] |
This file contains hidden or 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
{ | |
"_meta": { | |
"hash": { | |
"sha256": "b802fff146f9ce84e1e9281ab16181a877ecd5981ecca9e462dcac13099e5b7e" | |
}, | |
"host-environment-markers": { | |
"implementation_name": "cpython", | |
"implementation_version": "3.6.3", | |
"os_name": "posix", | |
"platform_machine": "x86_64", |
This file contains hidden or 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
class Customer: | |
def __init__(self, name, address, state, zipcode, contact_name, | |
phone_number, email, notes): | |
self.name = name | |
self.address = address | |
self.state = state | |
self.zipcode = zipcode | |
self.contact_name = contact_name | |
self.phone_number = phone_number |
This file contains hidden or 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
import unittest | |
from faker import Faker | |
from customer import Customer | |
class TestCustomer(unittest.TestCase): | |
def setUp(self): |
This file contains hidden or 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
from faker import Faker | |
fake = Faker('es_ES') | |
print(fake.name()) | |
print(fake.address()) | |
print(fake.phone_number()) |
This file contains hidden or 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
from faker.providers import BaseProvider | |
class PlanetProvider(BaseProvider): | |
__provider__ = 'planet' | |
__lang___ = 'en_US' | |
planets = ['Neptune', 'Mars', 'Mercury', 'Venus', 'Earth', 'Jupiter', 'Saturn', 'Uranus'] |