Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Obsługa ciasteczek python
tomi0001
post 29.05.2018, 08:43:22
Post #1





Grupa: Zarejestrowani
Postów: 27
Pomógł: 0
Dołączył: 31.05.2014

Ostrzeżenie: (0%)
-----


Nie było działu python więc temat zakładam tu
Mam taki problem nie wiem jak zaijniclować cistaeczka w pythonie moją stronę wykonuję w cgi i teraz próbowałem juz różnych opcji zaijnicjowania ciasteczek, ale żadna nie działała to znaczy wiem że nie sa zainicjowane bo w ustaienaich przeglądarki nie ma.
Próbowałem czegoś takiego
  1. import Cookie
  2. def show_cookie(c):
  3. for key, morsel in c.iteritems():
  4. print 'key =', morsel.key
  5. print ' value =', morsel.value
  6. print ' coded_value =', morsel.coded_value
  7. for name in morsel.keys():
  8. if morsel[name]:
  9. print ' %s = %s' % (name, morsel[name])
  10.  
  11. c = Cookie.SimpleCookie()
  12.  
  13. # A cookie with a value that has to be encoded to fit into the header
  14. #c['encoded_value_cookie'] = '"cookie_value"'
  15. #c['encoded_value_cookie']['comment'] = 'Notice that this cookie value has escaped quotes'
  16.  
  17. # A cookie that only applies to part of a site
  18. #c['restricted_cookie'] = 'cookie_value'
  19. #c['restricted_cookie']['path'] = '/sub/path'
  20. #c['restricted_cookie']['domain'] = 'PyMOTW'
  21. #c['restricted_cookie']['secure'] = True
  22.  
  23. # A cookie that expires in 5 minutes
  24. #c['with_max_age'] = 'expires in 5 minutes'
  25. #c['with_max_age']['max-age'] = 300 # seconds
  26.  
  27. # A cookie that expires at a specific time
  28. #c['expires_at_time'] = 'cookie_value'
  29. #expires = datetime.datetime(2019, 2, 14, 18, 30, 14) + datetime.timedelta(hours=1)
  30. #c['expires_at_time']['expires'] = datetime.datetime(2019, 2, 14, 18, 30, 14) + datetime.timedelta(hours=1) # Wdy, DD-Mon-YY HH:MM:SS GMT
  31.  
  32. show_cookie(c)

I nic nie daje.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 31.07.2025 - 10:41