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
from time import sleep | |
from facebook_business.api import FacebookAdsApi | |
from facebook_business.adobjects.adaccount import AdAccount | |
from django.conf import settings | |
my_app_id = settings.SOCIAL_AUTH_FACEBOOK_KEY | |
my_app_secret = settings.SOCIAL_AUTH_FACEBOOK_SECRET | |
user = User.objects.get(email="[email protected]") |
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
from rider.models import * | |
rides_with_ck_ids = CheckRide.objects.all().values_list('ride_id', flat=True) | |
rides_ids = Ride.objects.all().values_list('id', flat=True) | |
rides_without_ck_ids = [] | |
for id in rides_ids: | |
if id not in rides_with_ck_ids: | |
rides_without_ck_ids.append(id) |
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
class Foo: | |
def bar(self): | |
print(1) | |
class Mixin: | |
def bar(self): | |
print(2) | |
class New(Foo, Mixin): | |
pass |
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
# demandas duplicadas | |
from api.models import * | |
from datetime import timedelta | |
ids_duplicated = [] | |
for diligencia in Diligencia.objects.all().order_by('-id'): | |
if diligencia.id in ids_duplicated: | |
continue | |
user = diligencia.user |
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
1 sudo apt update | |
2 sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
3 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
4 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
5 sudo apt update | |
6 apt-cache policy docker-ce | |
7 sudo apt install docker-ce | |
8 sudo systemctl status docker | |
9 sudo apt-get install git -y | |
10 git clone [email protected]:codevance/consulta_cnpj.git git |
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
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> | |
<soap-env:Header> | |
<ns0:User xmlns:ns0="http://www.b2breservas.com.br/b2bws/types/">xxx</ns0:User> | |
<ns1:Password xmlns:ns1="http://www.b2breservas.com.br/b2bws/types/">xxx</ns1:Password> | |
</soap-env:Header> | |
<soap-env:Body> | |
<ns0:OTA_PingRQ EchoToken="1234" Version="3.000" xmlns:ns0="http://www.opentravel.org/OTA/2003/05/alpha"> | |
<ns0:EchoData>1</ns0:EchoData> | |
</ns0:OTA_PingRQ> | |
</soap-env:Body> |
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
from django import models | |
from django.test import TestCase | |
class Person(models.Model): | |
first_name = models.CharField(max_length=30) | |
last_name = models.CharField(max_length=30, null=True) | |
age = models.PositiveIntegerField() | |
def __str__(self): | |
return '{} {}'.format(self.first_name, self.last_name) |
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
from django.test import TestCase | |
from myapp.models import Person | |
class PersonTestCase(TestCase): | |
def test_should_return_attributes(self): | |
self.assertTrue(hasattr(Person, 'first_name')) | |
self.assertTrue(hasattr(Person, 'last_name')) | |
self.assertTrue(hasattr(Person, 'age')) | |
def test_should_create_item(self): |
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
from django.test import TestCase | |
from myapp.models import Person | |
class PersonTestCase(TestCase): | |
def test_should_return_attributes(self): | |
self.assertTrue(hasattr(Person, 'first_name')) | |
self.assertTrue(hasattr(Person, 'last_name')) | |
self.assertTrue(hasattr(Person, 'age')) | |
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
try: | |
Person.objects.get(id=1) | |
except Person.DoesNotExists: | |
print('não existe') |
NewerOlder