Access VBA to Connect Http Request Like Python Used

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • u70115
    New Member
    • May 2018
    • 1

    Access VBA to Connect Http Request Like Python Used

    I have a Python Code As given below that I wish to use Access VBA to do the same thing.

    Here is the Python Code example:

    import datetime
    import pytz
    import hmac
    import hashlib
    import base64

    username = "username"
    password = "password"
    access_token = "access_tok en"
    secret_key = "secret_key "
    date=datetime.d atetime.now(tz= pytz.utc).astim ezone(pytz.time zone('US/Pacific')).strf time('%m%d%Y')
    print(date);
    string_to_sign = username + password + access_token + date
    print(string_to _sign);
    print(secret_ke y);
    print(hashlib.s ha1)
    encoded = string_to_sign. encode('UTF-8')
    print(encoded)
    digest = hmac.new(secret _key.encode(), encoded,hashlib .sha1).digest()
    digest=base64.b 64encode(digest )
    headers=dict(Au thorization='NN N {}:{}'.format(a ccess_token, digest))
    print(headers)


    I need help to determine the functions that I have no concept of it in VBA. For example, hashlib.sha1 ? What can I use with VBA here???

    What can I use with VBA for string_to sign.enccode('U TF-8')??

    What can I use for the hmac.new function???

    What can I use for the base64.b64encod e() function???

    What can I use for the dict() function????

    If there isn't a VBA version of the function, a description could help me develope a version for VBA.

    I am using Office 2013 VBA from Access, etc.

    I would appreciate any help you can offer!!!!

    Thank You,
Working...