#!!! pip3 install 2captcha-python
import requests
from bs4 import BeautifulSoup
from twocaptcha import TwoCaptcha
def get_content(html):
soup = BeautifulSoup(html, 'html.parser')
item = soup.find('input', attrs={'name': '_csrf_token'})
csrf = item['value']
return csrf
solver = TwoCaptcha('TOKEN')
g_recaptcha = ''
try:
result = solver.recaptcha(
sitekey='6LftX68ZAAAAAOvXzEPz4lx9jgzfHdU3uVj-ptKT',
url='https://3ddd.ru/login',
invisible=1)
except Exception as e:
exit(e)
else:
g_recaptcha = result['code']
header = {
# 'user-agent': user
}
url = 'https://3ddd.ru/login'
url_form = 'https://3ddd.ru/login_check'
loging = requests.get(url, headers=header)
loging_cookies = loging.cookies
login_csrf = get_content(loging.text)
datas = {
'_username': 'EMAIL',
'_password': 'PASS',
'_csrf_token': login_csrf,
'g-recaptcha-response': g_recaptcha,
}
loging2 = requests.post(url_form, data=datas, headers=header, cookies=loging_cookies)
print(loging2.text)
return reverse('book-detail', kwargs={'id': self.id})
url(r'^book/(?P<pk>\d+)$', views.BookDetailView.as_view(), name='book-detail'),
', '.join([ genre.name for genre in self.genre.all()[:3] ])
Перечисляет первые 3 имени в модели через запятую, на сколько я помню по синтаксисуreadonly_fields = ('id', 'get_photo', 'pub_date')
STATIC_URL = "/staticfiles/"
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static_files")]
if bool(settings.DEBUG):
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
<tr data-id="1" data-table="table1">
...
<td><button class="btnEdit">Edit</button></td>
</tr>
$( ".btnEdit" ).on( "click", function() {
console.log( $( this ).parent("tr").data("id") );
});
...
networks:
- nginx_proxy_network
networks:
nginx_proxy_network:
external: false
name: nginx_proxy_network
...
environment:
- VIRTUAL_HOST=example.com
networks:
default:
external:
name: nginx_proxy_network