decode the django session value in django 3.1 - python-3.6

Not able to decode Django session values which are being stored in django_session table.
session_data='.eJxVizsOwjAQBe_iGkX-bOw1JRUNFQew1vauEgGJRHCFuDsBpYDmFfNmnipRewypLXxPY1V75Yy1fQ-IRmsDOgZUu18pU7nw9DFvNE7d99jY0p3XPbZ8mitfD5v4Vw-0DGtaKhYkAijRaTQZvBQNHCvXaGxw4kkc5AxggwThKlgE2HuTiYNG9XoD3Gw7Mg:1llsLN:oAVvWg9xxXEmdaxYHzbJ3Ltv0UQ-i-NOt_KaHgUilhA'
I tried all the possibilities with base64 like base64.b64decode and getting binascii.Error: Incorrect padding error.
base64.b64decode(session_data)
I cant use Django inbuilt function like below in the image because I am outside of Django service
I need to get the dict data with decoding. Please help.

Related

Postman Collection- Setting Authorization header through code

Everytime I am testing postman collection ,I need to change the authorization token under header manually followed by exporting the collection again and running through newman.
Is there any way , instead of giving here, I can give it in a CSV file which is being used as test data file. which would reduce the efforts of changing code every time.
Please suggest.
Yes you can, in your csv file, add one more column - name as "AT"
and mention that reference AT in your request as in the following picture.

WP Rest API, when using _embed JSON errors

When I fetch data from this endpoint http://blog.local/wp-json/wp/v2/posts?page=1 I get a JSON object.
When I add the _embed param,http://blog.local/wp-json/wp/v2/posts?page=1&_embed, I get an image, no JSON.
According to the Wordpress documentation, when you pass the _embed parameter, you are supposed to get extra usefull data included in the response - here
I just get an actual JPG image returned.
Has anyone seen this before or know what the problem could be? I have to resort to adding custom endpoint to just get extra data back.
Okay so it turns out that a plugin I'm using to create fake posts (FakePress) for testing was causing the issue. Don't know how but disabling fixes the problem.

How to pass any URL to an APIFY task?

There is a box to configure the "Start URL" in APIFY, but what happens if i don't know the start URL and it depends of my user input? I would like to be able to pass a variable URL to "Start URL"
Configuration of Start URL in APIFY:
I want to pass any URL automatically through an APIFY task and then scrap it.
I tried to make it automatically through Zapier, in the configuration is possible to select the URL input and pass it to APIFY, but finally it stops the task because is not able to read the format passed. Data out log from Zapier:
I think that APIFY probably lets configure dynamic input URL's but by my beginner level, probably there is something that scapes from my knowledge.
I want to be able to pass variable URL's to be scraped by APIFY.
You can check how input looks like in JSON format using Editor/JSON switcher on the top of input configuration.
After you switch to JSON you can easily check the structure of startUrls.
If you want to override startUrls for example in Zapier integration you can do it using Input JSON overrides field in Run Task Apify<>Zapier action.
You can override input same way using API to run the task, where you need to pass JSON as POST payload of the API request.
If you want to read more about Apify<>Zapier integration you can check article Scrape single URL using Zapier.

Parameter Error when trying to write into Access Database

I received the following error on an application which I'm using Classic ASP as
the programming language, and Access Database (accdb)
ADODB.Parameter error '800a0d5d'
Application uses a value of the wrong type for the current operation.
I'm using memo as the data type in Access Database. The content which I'm trying to write into the database is retrieved from a Text Area, and contains HTML Scripts.
Here's the parameter:
objCommand.Parameters(1).value = content
Anyone has any suggestions on what I should do?
Use objCommand.Parameters(1) for to force convert to string

Get current computer datetimeformat

Hi
I am new to web programming and I have an mvc app which runs on azure. There is a functionality where users can export grid data to csv and one of the fields is a datetime field. When the user clicks on export I take whatever is in the grid, format it to csv and then return a FileContentResult. The problem I have is that since the construction of the csv is happenning on the server, the dateformat is formatted to be en-US since I guess thats the VMs setting. I need to however use the users datetimeformat. Is there a way I can achieve this
You can get client culture from the header. Take a look at HttpContext.Current.Request.Browser

Resources